fix/schematic #375
Errors 88, Warnings 20
Found 88 errors and 20 warnings
Annotations
Check warning on line 22 in schematics/schematics/scripts/cjs-build.script.ts
github-actions / Lint
(no-console): Unexpected console statement.
Unexpected console statement.
Raw output
19 | renameJsImportsBuildPart({ outDir })
20 |
> 21 | console.info('schematic build successed')
| ^
22 |
Check failure on line 23 in schematics/schematics-utils/scripts/cjs-build.script.mjs
github-actions / Lint
(@typescript-eslint/no-shadow): 'dir' is already declared in the upper scope on line 15 column 7.
'dir' is already declared in the upper scope on line 15 column 7.
Raw output
20 |
21 | // Рекурсивный поиск всех файлов в директории
> 22 | function getAllFiles(dir, fileList = []) {
| ^
23 | readdirSync(dir).forEach((file) => {
24 | const fullPath = join(dir, file)
25 | if (statSync(fullPath).isDirectory()) {
Check failure on line 24 in schematics/schematics-utils/scripts/cjs-build.script.mjs
github-actions / Lint
(n/no-sync): Unexpected sync method: 'readdirSync'.
Unexpected sync method: 'readdirSync'.
Raw output
21 | // Рекурсивный поиск всех файлов в директории
22 | function getAllFiles(dir, fileList = []) {
> 23 | readdirSync(dir).forEach((file) => {
| ^
24 | const fullPath = join(dir, file)
25 | if (statSync(fullPath).isDirectory()) {
26 | getAllFiles(fullPath, fileList)
Check failure on line 26 in schematics/schematics-utils/scripts/cjs-build.script.mjs
github-actions / Lint
(n/no-sync): Unexpected sync method: 'statSync'.
Unexpected sync method: 'statSync'.
Raw output
23 | readdirSync(dir).forEach((file) => {
24 | const fullPath = join(dir, file)
> 25 | if (statSync(fullPath).isDirectory()) {
| ^
26 | getAllFiles(fullPath, fileList)
27 | } else {
28 | fileList.push(fullPath)
Check failure on line 37 in schematics/schematics-utils/scripts/cjs-build.script.mjs
github-actions / Lint
(@typescript-eslint/no-shadow): 'dir' is already declared in the upper scope on line 15 column 7.
'dir' is already declared in the upper scope on line 15 column 7.
Raw output
34 | // Создаём структуру директорий в `dist`
35 | function ensureDirStructure(filePath) {
> 36 | const dir = dirname(filePath)
| ^
37 | mkdirSync(dir, { recursive: true })
38 | }
39 |
Check failure on line 38 in schematics/schematics-utils/scripts/cjs-build.script.mjs
github-actions / Lint
(n/no-sync): Unexpected sync method: 'mkdirSync'.
Unexpected sync method: 'mkdirSync'.
Raw output
35 | function ensureDirStructure(filePath) {
36 | const dir = dirname(filePath)
> 37 | mkdirSync(dir, { recursive: true })
| ^
38 | }
39 |
40 | // Получаем все файлы из `src/`
Check failure on line 61 in schematics/schematics-utils/scripts/cjs-build.script.mjs
github-actions / Lint
(n/no-sync): Unexpected sync method: 'renameSync'.
Unexpected sync method: 'renameSync'.
Raw output
58 | if (extname(file) === '.js') {
59 | const newPath = join(dirname(file), `${basename(file, '.js')}.cjs`)
> 60 | renameSync(file, newPath)
| ^
61 | }
62 | })
63 |
Check failure on line 71 in schematics/schematics-utils/scripts/cjs-build.script.mjs
github-actions / Lint
(n/no-sync): Unexpected sync method: 'copyFileSync'.
Unexpected sync method: 'copyFileSync'.
Raw output
68 | const destPath = join(outDir, relativePath)
69 | ensureDirStructure(destPath)
> 70 | copyFileSync(file, destPath)
| ^
71 | }
72 | })
73 |
Check failure on line 78 in schematics/schematics-utils/scripts/cjs-build.script.mjs
github-actions / Lint
(n/no-sync): Unexpected sync method: 'readFileSync'.
Unexpected sync method: 'readFileSync'.
Raw output
75 | getAllFiles(outDir).forEach((file) => {
76 | if (extname(file) === '.cjs') {
> 77 | let content = readFileSync(file, 'utf8')
| ^
78 |
79 | // Заменяем `.js` импорты на `.cjs`
80 | content = content.replace(/(require\(['"]\.\/.*?)(\.js)(['"]\))/g, '$1.cjs$3')
Check failure on line 84 in schematics/schematics-utils/scripts/cjs-build.script.mjs
github-actions / Lint
(n/no-sync): Unexpected sync method: 'writeFileSync'.
Unexpected sync method: 'writeFileSync'.
Raw output
81 | content = content.replace(/(import .*? from ['"]\.\/.*?)(\.js)(['"])/g, '$1.cjs$3')
82 |
> 83 | writeFileSync(file, content)
| ^
84 | }
85 | })
86 |
Check warning on line 88 in schematics/schematics-utils/scripts/cjs-build.script.mjs
github-actions / Lint
(no-console): Unexpected console statement.
Unexpected console statement.
Raw output
85 | })
86 |
> 87 | console.log('✅ Все файлы сконвертированы в `.cjs`, `.json` остались без изменений.')
| ^
88 | console.log('✅ Импорты в `index.cjs` обновлены с `.js` → `.cjs`.')
89 |
Check warning on line 89 in schematics/schematics-utils/scripts/cjs-build.script.mjs
github-actions / Lint
(no-console): Unexpected console statement.
Unexpected console statement.
Raw output
86 |
87 | console.log('✅ Все файлы сконвертированы в `.cjs`, `.json` остались без изменений.')
> 88 | console.log('✅ Импорты в `index.cjs` обновлены с `.js` → `.cjs`.')
| ^
89 |
github-actions / Lint
(@typescript-eslint/explicit-function-return-type): Missing return type on function.
Missing return type on function.
Raw output
13 | }
14 |
> 15 | export const cpJsonAndTemplatesToDistBuildPart = ({ srcDir, outDir, allFiles }: Props) => {
| ^
16 | allFiles.forEach((file) => {
17 | const isTemplate = checkTemplateFileUtil(srcDir, file)
18 | if (extname(file) === '.json' || isTemplate) {
github-actions / Lint
(@typescript-eslint/explicit-module-boundary-types): Missing return type on function.
Missing return type on function.
Raw output
13 | }
14 |
> 15 | export const cpJsonAndTemplatesToDistBuildPart = ({ srcDir, outDir, allFiles }: Props) => {
| ^
16 | allFiles.forEach((file) => {
17 | const isTemplate = checkTemplateFileUtil(srcDir, file)
18 | if (extname(file) === '.json' || isTemplate) {
github-actions / Lint
(n/no-sync): Unexpected sync method: 'copyFileSync'.
Unexpected sync method: 'copyFileSync'.
Raw output
20 | const destPath = join(outDir, relativePath)
21 | ensureDirStructureUtil(destPath)
> 22 | copyFileSync(file, destPath)
| ^
23 | }
24 | })
25 | }
Check failure on line 10 in schematics/schematics/scripts/build-parts/main.build-part.ts
github-actions / Lint
(@typescript-eslint/explicit-function-return-type): Missing return type on function.
Missing return type on function.
Raw output
7 | }
8 |
> 9 | export const mainBuildPart = async ({ allFiles, outDir }: MainBuildPartProps) => {
| ^
10 | const tsJsFiles = allFiles.filter((file) => ['.ts', '.js'].includes(extname(file)))
11 |
12 | await esbuild.build({
Check failure on line 10 in schematics/schematics/scripts/build-parts/main.build-part.ts
github-actions / Lint
(@typescript-eslint/explicit-module-boundary-types): Missing return type on function.
Missing return type on function.
Raw output
7 | }
8 |
> 9 | export const mainBuildPart = async ({ allFiles, outDir }: MainBuildPartProps) => {
| ^
10 | const tsJsFiles = allFiles.filter((file) => ['.ts', '.js'].includes(extname(file)))
11 |
12 | await esbuild.build({
github-actions / Lint
(@typescript-eslint/explicit-function-return-type): Missing return type on function.
Missing return type on function.
Raw output
9 | }
10 |
> 11 | export const renameJsImportsBuildPart = ({ outDir }: Props) => {
| ^
12 | getAllFiles(outDir).forEach((file) => {
13 | if (extname(file) === '.cjs') {
14 | let content = readFileSync(file, 'utf8')
github-actions / Lint
(@typescript-eslint/explicit-module-boundary-types): Missing return type on function.
Missing return type on function.
Raw output
9 | }
10 |
> 11 | export const renameJsImportsBuildPart = ({ outDir }: Props) => {
| ^
12 | getAllFiles(outDir).forEach((file) => {
13 | if (extname(file) === '.cjs') {
14 | let content = readFileSync(file, 'utf8')
github-actions / Lint
(n/no-sync): Unexpected sync method: 'readFileSync'.
Unexpected sync method: 'readFileSync'.
Raw output
12 | getAllFiles(outDir).forEach((file) => {
13 | if (extname(file) === '.cjs') {
> 14 | let content = readFileSync(file, 'utf8')
| ^
15 | content = content.replace(/(\.js)(['"])/g, '.cjs$2')
16 | writeFileSync(file, content)
17 | }
github-actions / Lint
(n/no-sync): Unexpected sync method: 'writeFileSync'.
Unexpected sync method: 'writeFileSync'.
Raw output
14 | let content = readFileSync(file, 'utf8')
15 | content = content.replace(/(\.js)(['"])/g, '.cjs$2')
> 16 | writeFileSync(file, content)
| ^
17 | }
18 | })
19 | }
Check failure on line 15 in schematics/schematics/scripts/build-parts/rename-js-to-cjs.build-part.ts
github-actions / Lint
(@typescript-eslint/explicit-function-return-type): Missing return type on function.
Missing return type on function.
Raw output
12 | }
13 |
> 14 | export const renameJsToCjsBuildPart = ({ outDir }: Props) => {
| ^
15 | getAllFiles(outDir).forEach((file) => {
16 | const isTemplate = checkTemplateFileUtil(outDir, file)
17 | console.log(isTemplate, file)
Check failure on line 15 in schematics/schematics/scripts/build-parts/rename-js-to-cjs.build-part.ts
github-actions / Lint
(@typescript-eslint/explicit-module-boundary-types): Missing return type on function.
Missing return type on function.
Raw output
12 | }
13 |
> 14 | export const renameJsToCjsBuildPart = ({ outDir }: Props) => {
| ^
15 | getAllFiles(outDir).forEach((file) => {
16 | const isTemplate = checkTemplateFileUtil(outDir, file)
17 | console.log(isTemplate, file)
Check warning on line 18 in schematics/schematics/scripts/build-parts/rename-js-to-cjs.build-part.ts
github-actions / Lint
(no-console): Unexpected console statement.
Unexpected console statement.
Raw output
15 | getAllFiles(outDir).forEach((file) => {
16 | const isTemplate = checkTemplateFileUtil(outDir, file)
> 17 | console.log(isTemplate, file)
| ^
18 | if (extname(file) === '.js' && !isTemplate) {
19 | const newPath = join(dirname(file), `${basename(file, '.js')}.cjs`)
20 | renameSync(file, newPath)
Check failure on line 21 in schematics/schematics/scripts/build-parts/rename-js-to-cjs.build-part.ts
github-actions / Lint
(n/no-sync): Unexpected sync method: 'renameSync'.
Unexpected sync method: 'renameSync'.
Raw output
18 | if (extname(file) === '.js' && !isTemplate) {
19 | const newPath = join(dirname(file), `${basename(file, '.js')}.cjs`)
> 20 | renameSync(file, newPath)
| ^
21 | }
22 | })
23 | }