feat: fragments generator #93
Errors 14, Warnings 0
Found 14 errors and 0 warnings
Annotations
Check failure on line 2 in fragments/fragments-cli/src/index.ts
github-actions / Lint
(@typescript-eslint/no-unused-vars): 'createInterface' is defined but never used.
'createInterface' is defined but never used.
Raw output
> 1 | import { createInterface } from 'node:readline'
| ^
2 |
3 | import logger from 'npmlog'
4 | import { program } from 'commander'
Check failure on line 42 in fragments/fragments-cli/src/index.ts
github-actions / Lint
(dot-notation): ["FIGMA_TOKEN"] is better written in dot notation.
["FIGMA_TOKEN"] is better written in dot notation.
Raw output
39 | // })
40 |
> 41 | process.env['FIGMA_TOKEN'] = 'secret'
| ^
42 |
43 | run(fileId, options.nodeId, options.output, options.theme)
44 | .then(() => logger.info('info', 'Fragments successful generated'))
Check failure on line 20 in utils/file/src/process-file.util.ts
github-actions / Lint
(prefer-destructuring): Use object destructuring.
Use object destructuring.
Raw output
17 |
18 | const module = { exports: {} }
> 19 | const exports = module.exports
| ^
20 | const require = (modulePath: string): any => {
21 | const absolutePath = path.resolve(path.dirname(filePath), modulePath)
22 | return processFile(absolutePath)
Check failure on line 20 in utils/file/src/process-file.util.ts
github-actions / Lint
(@typescript-eslint/no-unused-vars): 'exports' is assigned a value but never used.
'exports' is assigned a value but never used.
Raw output
17 |
18 | const module = { exports: {} }
> 19 | const exports = module.exports
| ^
20 | const require = (modulePath: string): any => {
21 | const absolutePath = path.resolve(path.dirname(filePath), modulePath)
22 | return processFile(absolutePath)
Check failure on line 21 in utils/file/src/process-file.util.ts
github-actions / Lint
(@typescript-eslint/no-unused-vars): 'require' is assigned a value but never used.
'require' is assigned a value but never used.
Raw output
18 | const module = { exports: {} }
19 | const exports = module.exports
> 20 | const require = (modulePath: string): any => {
| ^
21 | const absolutePath = path.resolve(path.dirname(filePath), modulePath)
22 | return processFile(absolutePath)
23 | }
Check failure on line 26 in utils/file/src/process-file.util.ts
github-actions / Lint
(security/detect-eval-with-expression): Definition for rule 'security/detect-eval-with-expression' was not found.
Definition for rule 'security/detect-eval-with-expression' was not found.
Raw output
23 | }
24 |
> 25 | // eslint-disable-next-line no-eval, security/detect-eval-with-expression
| ^
26 | eval(`
27 | (function(exports, module, require) {
28 | ${code}
Check failure on line 8 in fragments/fragments-generator/src/strategy/create-box.strategy.ts
github-actions / Lint
(@typescript-eslint/no-useless-constructor): Useless constructor.
Useless constructor.
Raw output
5 |
6 | export class CreateBoxStrategy extends ThemeMappingStrategy {
> 7 | constructor(theme: Record<string, Record<string, string>>) {
| ^
8 | super(theme)
9 | }
10 |
Check failure on line 26 in fragments/fragments-generator/src/strategy/create-fragment.strategy.ts
github-actions / Lint
(lines-between-class-members): Expected blank line between class members.
Expected blank line between class members.
Raw output
23 |
24 | private text: CreateTextStrategy
> 25 | private box: CreateBoxStrategy
| ^
26 | private button: CreateButtonStrategy
27 |
28 | constructor(theme: Record<string, Record<string, string>>) {
Check failure on line 27 in fragments/fragments-generator/src/strategy/create-fragment.strategy.ts
github-actions / Lint
(lines-between-class-members): Expected blank line between class members.
Expected blank line between class members.
Raw output
24 | private text: CreateTextStrategy
25 | private box: CreateBoxStrategy
> 26 | private button: CreateButtonStrategy
| ^
27 |
28 | constructor(theme: Record<string, Record<string, string>>) {
29 | this.text = new CreateTextStrategy(theme)
Check failure on line 77 in fragments/fragments-generator/src/strategy/create-fragment.strategy.ts
github-actions / Lint
(@typescript-eslint/no-shadow): 'node' is already declared in the upper scope on line 71 column 18.
'node' is already declared in the upper scope on line 71 column 18.
Raw output
74 | this.button.getImports().forEach((value) => imports.add(value))
75 |
> 76 | const buttonChildren = node?.children.map((node) => node.id) || []
| ^
77 | const buttonDeepChildren = isInstance(node.children[0])
78 | ? node.children[0].children.map((node) => node.id) || []
79 | : []
Check failure on line 79 in fragments/fragments-generator/src/strategy/create-fragment.strategy.ts
github-actions / Lint
(@typescript-eslint/no-shadow): 'node' is already declared in the upper scope on line 71 column 18.
'node' is already declared in the upper scope on line 71 column 18.
Raw output
76 | const buttonChildren = node?.children.map((node) => node.id) || []
77 | const buttonDeepChildren = isInstance(node.children[0])
> 78 | ? node.children[0].children.map((node) => node.id) || []
| ^
79 | : []
80 |
81 | this.elements[node.id] = {
Check failure on line 105 in fragments/fragments-generator/src/strategy/create-fragment.strategy.ts
github-actions / Lint
(@typescript-eslint/no-shadow): 'node' is already declared in the upper scope on line 71 column 18.
'node' is already declared in the upper scope on line 71 column 18.
Raw output
102 | this.elements[node.id] = {
103 | element: this.box.createElement(node),
> 104 | childrenIds: node?.children.map((node) => node.id) || [],
| ^
105 | parentId: this.findParentId(node.id),
106 | }
107 | }
Check failure on line 11 in fragments/fragments-generator/src/strategy/create-text.strategy.ts
github-actions / Lint
(@typescript-eslint/no-useless-constructor): Useless constructor.
Useless constructor.
Raw output
8 |
9 | export class CreateTextStrategy extends ThemeMappingStrategy {
> 10 | constructor(theme: Record<string, Record<string, string>>) {
| ^
11 | super(theme)
12 | }
13 |
Check failure on line 36 in fragments/fragments-generator/src/strategy/theme-mapping.strategy.ts
github-actions / Lint
(consistent-return): Method 'getValueKeyFromTheme' expected no return value.
Method 'getValueKeyFromTheme' expected no return value.
Raw output
33 | })?.[0]
34 |
> 35 | return valueKey ? `${THEME_KEY_PREFIX}${valueKey}` : undefined
| ^
36 | }
37 |
38 | getColor(fills: readonly Paint[]): string | undefined {