@diplodoc/lint 1.9.0 → 1.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.eslintignore CHANGED
@@ -14,8 +14,14 @@ node_modules
14
14
  test/
15
15
  # Scripts use Node.js globals
16
16
  scripts/
17
+ # Bin scripts use Node.js globals
18
+ bin/
17
19
 
18
20
  .lintstagedrc.js
19
21
  .eslintrc.js
20
22
  .prettierrc.js
21
- .stylelintrc.js
23
+ .stylelintrc.js
24
+ build/
25
+ build/**
26
+ esbuild/
27
+ esbuild/**/*.mjs
package/.eslintrc.js CHANGED
@@ -1,3 +1,8 @@
1
+ // ⚠️ AUTO-GENERATED FILE - DO NOT EDIT MANUALLY
2
+ // This file is automatically generated and updated by `@diplodoc/lint update`
3
+ // Any manual changes will be overwritten on the next update
4
+ // To customize ESLint configuration, see: https://github.com/diplodoc-platform/lint#configuration
5
+
1
6
  module.exports = {
2
7
  root: true,
3
8
  extends: require.resolve('@diplodoc/lint/eslint-config'),
@@ -10,6 +15,31 @@ module.exports = {
10
15
  files: ['*.mjs', '*.cjs'],
11
16
  parserOptions: {
12
17
  project: null,
18
+ ecmaVersion: 'latest',
19
+ sourceType: 'module',
20
+ },
21
+ env: {
22
+ node: true,
23
+ es2022: true,
24
+ },
25
+ },
26
+ {
27
+ files: ['test/**/*.{js,jsx,ts,tsx}'],
28
+ env: {
29
+ jest: true,
30
+ node: true,
31
+ },
32
+ },
33
+ {
34
+ files: ['scripts/**/*.{js,jsx,ts,tsx}'],
35
+ env: {
36
+ node: true,
37
+ },
38
+ },
39
+ {
40
+ files: ['bin/**/*.{js,jsx,ts,tsx}', 'bin/*.{js,jsx,ts,tsx}'],
41
+ env: {
42
+ node: true,
13
43
  },
14
44
  },
15
45
  ],
package/.gitattributes CHANGED
@@ -30,3 +30,5 @@
30
30
  *.ttf binary
31
31
  *.eot binary
32
32
 
33
+
34
+
package/.lintstagedrc.js CHANGED
@@ -1,8 +1,26 @@
1
1
  /* eslint-env node */
2
+ // ⚠️ AUTO-GENERATED FILE - DO NOT EDIT MANUALLY
3
+ // This file is automatically generated and updated by `@diplodoc/lint update`
4
+ // Any manual changes will be overwritten on the next update
5
+ // To customize lint-staged configuration, see: https://github.com/diplodoc-platform/lint#configuration
6
+
7
+ const {readFileSync} = require('node:fs');
8
+ const {join} = require('node:path');
9
+
10
+ // Check if this is the @diplodoc/lint package itself
11
+ const isLintPkg = (() => {
12
+ try {
13
+ const pkg = JSON.parse(readFileSync(join(process.cwd(), 'package.json'), 'utf8'));
14
+ return pkg.name === '@diplodoc/lint';
15
+ } catch {
16
+ return false;
17
+ }
18
+ })();
19
+
2
20
  module.exports = {
3
- // Exclude config files and scripts from linting (they use CommonJS)
21
+ // Exclude config files from linting (they use CommonJS)
4
22
  '**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}': (filenames) => {
5
- // Filter out config files and scripts
23
+ // Filter out config files
6
24
  const configFiles = [
7
25
  '.lintstagedrc.js',
8
26
  '.eslintrc.js',
@@ -13,15 +31,17 @@ module.exports = {
13
31
  const filtered = filenames.filter(
14
32
  (f) =>
15
33
  !configFiles.some((config) => f.includes(config)) &&
16
- !f.includes('scripts/') &&
17
- !f.includes('test/'),
34
+ // For @diplodoc/lint package itself: exclude bin/ and scripts/ (in .eslintignore)
35
+ !(isLintPkg && (f.includes('bin/') || f.includes('scripts/'))),
18
36
  );
19
37
  if (filtered.length === 0) {
20
38
  return [];
21
39
  }
22
40
  return [
23
41
  ...filtered.map((f) => `prettier --write ${f}`),
24
- ...filtered.map((f) => `eslint --max-warnings=0 --fix ${f}`),
42
+ ...filtered.map(
43
+ (f) => `env ESLINT_USE_FLAT_CONFIG=false npx eslint --max-warnings=0 --fix ${f}`,
44
+ ),
25
45
  ];
26
46
  },
27
47
  // Handle .lintstagedrc.js separately (only prettier, no eslint)
package/.prettierrc.js CHANGED
@@ -1 +1,6 @@
1
+ // ⚠️ AUTO-GENERATED FILE - DO NOT EDIT MANUALLY
2
+ // This file is automatically generated and updated by `@diplodoc/lint update`
3
+ // Any manual changes will be overwritten on the next update
4
+ // To customize Prettier configuration, see: https://github.com/diplodoc-platform/lint#configuration
5
+
1
6
  module.exports = require('@diplodoc/lint/prettier-config');
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "1.9.0"
2
+ ".": "1.9.2"
3
3
  }
package/.stylelintrc.js CHANGED
@@ -1,3 +1,8 @@
1
+ // ⚠️ AUTO-GENERATED FILE - DO NOT EDIT MANUALLY
2
+ // This file is automatically generated and updated by `@diplodoc/lint update`
3
+ // Any manual changes will be overwritten on the next update
4
+ // To customize Stylelint configuration, see: https://github.com/diplodoc-platform/lint#configuration
5
+
1
6
  module.exports = {
2
7
  extends: require.resolve('@diplodoc/lint/stylelint-config'),
3
8
  };
package/AGENTS.md CHANGED
@@ -248,18 +248,20 @@ The `bin/` directory contains executable scripts that are made available via npm
248
248
  **Default mode** (`lint`):
249
249
 
250
250
  - Runs ESLint on all JS/TS files (check only)
251
- - Uses glob pattern `**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}`
252
- - ESLint automatically respects `.eslintignore` file
253
- - No manual file filtering needed
251
+ - Uses `ESLINT_USE_FLAT_CONFIG=false` to force legacy (ESLint 8-style) config resolution
252
+ - Calls ESLint with `.` и `--ext .js,.mjs,.cjs,.jsx,.ts,.mts,.cts,.tsx`, позволяя самому ESLint искать файлы
253
+ - ESLint автоматически читает `.eslintrc.js` и `.eslintignore` из корня пакета
254
+ - **Никакой** дополнительной фильтрации файлов в `bin/lint.js` не выполняется
254
255
  - Runs Prettier in check mode on all JS/TS files
255
256
  - Runs Stylelint on CSS/SCSS files (if found and not ignored)
256
257
 
257
258
  **Fix mode** (`lint fix`):
258
259
 
259
260
  - Runs ESLint with `--fix` flag (auto-fixes issues)
260
- - Uses glob pattern `**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}`
261
- - ESLint automatically respects `.eslintignore` file
262
- - No manual file filtering needed
261
+ - Использует те же настройки, что и в check-режиме:
262
+ - `ESLINT_USE_FLAT_CONFIG=false`
263
+ - таргет `.` и расширения через `--ext`
264
+ - Игнорирование файлов полностью делегировано ESLint и `.eslintignore`
263
265
  - Runs Prettier with `--write` flag (formats files)
264
266
  - Runs Stylelint with `--fix` flag (auto-fixes CSS issues)
265
267
 
@@ -420,6 +422,29 @@ Files in `scaffolding/` are copied to packages during `init`/`update`:
420
422
  - System files: `.idea`, `.vscode`, `.history`, `.env`, `.DS_Store`
421
423
  - Build artifacts: `/lib`, `/dist`, `/build`, `/cache`, `/coverage`, `/external`
422
424
  - Dependencies: `node_modules`
425
+ - Additional ESLint-specific ignores: `esbuild/**/*.mjs` и конфигурационные файлы (`.lintstagedrc.js`, `.eslintrc.js`, `.prettierrc.js`, `.stylelintrc.js`)
426
+ - **Важно**:
427
+ - `test/` и `scripts/` **не** добавляются в `.eslintignore` автоматически, чтобы тесты и скрипты линтились
428
+ - Пакеты могут добавлять свои пути в `.eslintignore` при необходимости — это считается частью инфраструктуры конкретного пакета, а не `@diplodoc/lint`
429
+
430
+ ### Auto-generated configuration files
431
+
432
+ Часть конфигурации, которую поставляет `@diplodoc/lint`, считается **авто‑генерируемой** и не должна правиться руками в потребителях:
433
+
434
+ - `.eslintrc.js`
435
+ - `.prettierrc.js`
436
+ - `.stylelintrc.js`
437
+ - `.lintstagedrc.js`
438
+
439
+ Общие правила:
440
+
441
+ - Эти файлы копируются из `scaffolding/` при `lint init` / `lint update`
442
+ - Любые ручные правки в пакетах будут перезатираться при следующем `lint update`
443
+ - Изменять поведение нужно через:
444
+ - обновление шаблонов в `devops/lint/scaffolding/`
445
+ - явные локальные конфиги в пакетах (например, `src/.eslintrc.js`), если это допускается
446
+
447
+ Для деталей см. раздел **“⚠️ Important: Auto-Generated Files”** в `README.md` этого пакета.
423
448
 
424
449
  ## Testing
425
450
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.9.2](https://github.com/diplodoc-platform/lint/compare/v1.9.1...v1.9.2) (2025-12-29)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * use ESLINT_USE_FLAT_CONFIG=false in lint-staged ([88a17b6](https://github.com/diplodoc-platform/lint/commit/88a17b62a791cc491f195ed66b69f63964f89f9b))
9
+
10
+ ## [1.9.1](https://github.com/diplodoc-platform/lint/compare/v1.9.0...v1.9.1) (2025-12-29)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * remove test/ and scripts/ exclusion from lint-staged ([b52804b](https://github.com/diplodoc-platform/lint/commit/b52804be7efd9833f4b17a4779c22c2df24bc9cb))
16
+
3
17
  ## [1.9.0](https://github.com/diplodoc-platform/lint/compare/v1.8.0...v1.9.0) (2025-12-29)
4
18
 
5
19
 
package/README.md CHANGED
@@ -111,6 +111,29 @@ Automatically fixes found issues:
111
111
 
112
112
  ## Configuration
113
113
 
114
+ ### ⚠️ Important: Auto-Generated Files
115
+
116
+ The following configuration files are **automatically generated and updated** by `@diplodoc/lint`:
117
+
118
+ - `.eslintrc.js`
119
+ - `.prettierrc.js`
120
+ - `.stylelintrc.js`
121
+ - `.lintstagedrc.js`
122
+ - `.eslintignore`
123
+ - `.prettierignore`
124
+ - `.stylelintignore`
125
+ - `.gitignore` (patterns are added automatically)
126
+
127
+ **⚠️ DO NOT EDIT THESE FILES MANUALLY** — any changes will be overwritten on the next `lint update` (which runs automatically before each `lint` command).
128
+
129
+ If you need to customize configuration:
130
+
131
+ 1. Check if the customization can be done via package-level overrides (see below)
132
+ 2. If not, consider opening an issue or PR to `@diplodoc/lint` to add the feature
133
+ 3. For ignore patterns, they are managed automatically — if you need additional patterns, they should be added to `@diplodoc/lint`'s `modify-ignore.js` script
134
+
135
+ ### Configuration Files
136
+
114
137
  After initialization, the following files are created in the package root:
115
138
 
116
139
  ### `.eslintrc.js`
@@ -220,11 +243,13 @@ After `lint init`, the following scripts are added to `package.json`:
220
243
  The package automatically updates the following ignore files:
221
244
 
222
245
  - `.gitignore` — system files, dependencies, artifacts
223
- - `.eslintignore` — system files, dependencies, artifacts, `test/`, `scripts/`
246
+ - `.eslintignore` — system files, dependencies, artifacts, `test/`, `scripts/`, `build/`, `esbuild/`
224
247
  - `.prettierignore` — system files, dependencies, artifacts
225
248
  - `.stylelintignore` — system files, dependencies, artifacts
226
249
 
227
- Patterns are added automatically on `init` and `update`, duplicates are not created.
250
+ **⚠️ These files are auto-generated** — patterns are added automatically on `init` and `update`, duplicates are not created. Manual edits will be overwritten.
251
+
252
+ If you need additional ignore patterns, they should be added to `@diplodoc/lint`'s `modify-ignore.js` script.
228
253
 
229
254
  ## Testing
230
255
 
package/bin/lint.js CHANGED
@@ -58,6 +58,7 @@ function hasStyleFiles() {
58
58
  }
59
59
  }
60
60
 
61
+
61
62
  if (init || update) {
62
63
  if (init) {
63
64
  console.log('[@diplodoc/lint] Extend package.json configuration');
@@ -81,7 +82,17 @@ if (init || update) {
81
82
  if (fix) {
82
83
  console.log('Run linters in fix mode');
83
84
 
84
- execCommand(`"${join(binDir, 'eslint')}" '**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}' --fix`);
85
+ // Включаем legacy-режим ESLint (ESLint 8-style), чтобы:
86
+ // - читался .eslintrc.js
87
+ // - учитывался .eslintignore
88
+ // Флаг ESLINT_USE_FLAT_CONFIG=false документирован в ESLint 9
89
+ // как способ вернуться к старому поведению CLI.
90
+ execCommand(
91
+ `ESLINT_USE_FLAT_CONFIG=false "${join(
92
+ binDir,
93
+ 'eslint',
94
+ )}" . --ext .js,.mjs,.cjs,.jsx,.ts,.mts,.cts,.tsx --fix`,
95
+ );
85
96
  execCommand(`"${join(binDir, 'prettier')}" --write '**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}'`);
86
97
 
87
98
  if (hasStyleFiles()) {
@@ -89,13 +100,21 @@ if (fix) {
89
100
  }
90
101
 
91
102
  process.exit(0);
92
- }
93
-
94
- console.log('Run linters');
95
-
96
- execCommand(`"${join(binDir, 'eslint')}" '**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}'`);
97
- execCommand(`"${join(binDir, 'prettier')}" --check '**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}'`);
103
+ } else {
104
+ console.log('Run linters');
105
+
106
+ // То же самое для check-режима: используем legacy-режим ESLint,
107
+ // передаём точку и расширения — ESLint сам находит файлы и
108
+ // применяет .eslintignore.
109
+ execCommand(
110
+ `ESLINT_USE_FLAT_CONFIG=false "${join(
111
+ binDir,
112
+ 'eslint',
113
+ )}" . --ext .js,.mjs,.cjs,.jsx,.ts,.mts,.cts,.tsx`,
114
+ );
115
+ execCommand(`"${join(binDir, 'prettier')}" --check '**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}'`);
98
116
 
99
- if (hasStyleFiles()) {
100
- execCommand(`"${join(binDir, 'stylelint')}" '**/*.{css,scss}'`);
101
- }
117
+ if (hasStyleFiles()) {
118
+ execCommand(`"${join(binDir, 'stylelint')}" '**/*.{css,scss}'`);
119
+ }
120
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diplodoc/lint",
3
- "version": "1.9.0",
3
+ "version": "1.9.2",
4
4
  "description": "Diplodoc platform internal utility set for linting",
5
5
  "bin": {
6
6
  "lint": "./bin/lint.js",
@@ -1,3 +1,8 @@
1
+ // ⚠️ AUTO-GENERATED FILE - DO NOT EDIT MANUALLY
2
+ // This file is automatically generated and updated by `@diplodoc/lint update`
3
+ // Any manual changes will be overwritten on the next update
4
+ // To customize ESLint configuration, see: https://github.com/diplodoc-platform/lint#configuration
5
+
1
6
  module.exports = {
2
7
  root: true,
3
8
  extends: require.resolve('@diplodoc/lint/eslint-config'),
@@ -10,6 +15,31 @@ module.exports = {
10
15
  files: ['*.mjs', '*.cjs'],
11
16
  parserOptions: {
12
17
  project: null,
18
+ ecmaVersion: 'latest',
19
+ sourceType: 'module',
20
+ },
21
+ env: {
22
+ node: true,
23
+ es2022: true,
24
+ },
25
+ },
26
+ {
27
+ files: ['test/**/*.{js,jsx,ts,tsx}'],
28
+ env: {
29
+ jest: true,
30
+ node: true,
31
+ },
32
+ },
33
+ {
34
+ files: ['scripts/**/*.{js,jsx,ts,tsx}'],
35
+ env: {
36
+ node: true,
37
+ },
38
+ },
39
+ {
40
+ files: ['bin/**/*.{js,jsx,ts,tsx}', 'bin/*.{js,jsx,ts,tsx}'],
41
+ env: {
42
+ node: true,
13
43
  },
14
44
  },
15
45
  ],
@@ -30,3 +30,5 @@
30
30
  *.ttf binary
31
31
  *.eot binary
32
32
 
33
+
34
+
@@ -1,8 +1,26 @@
1
1
  /* eslint-env node */
2
+ // ⚠️ AUTO-GENERATED FILE - DO NOT EDIT MANUALLY
3
+ // This file is automatically generated and updated by `@diplodoc/lint update`
4
+ // Any manual changes will be overwritten on the next update
5
+ // To customize lint-staged configuration, see: https://github.com/diplodoc-platform/lint#configuration
6
+
7
+ const {readFileSync} = require('node:fs');
8
+ const {join} = require('node:path');
9
+
10
+ // Check if this is the @diplodoc/lint package itself
11
+ const isLintPkg = (() => {
12
+ try {
13
+ const pkg = JSON.parse(readFileSync(join(process.cwd(), 'package.json'), 'utf8'));
14
+ return pkg.name === '@diplodoc/lint';
15
+ } catch {
16
+ return false;
17
+ }
18
+ })();
19
+
2
20
  module.exports = {
3
- // Exclude config files and scripts from linting (they use CommonJS)
21
+ // Exclude config files from linting (they use CommonJS)
4
22
  '**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}': (filenames) => {
5
- // Filter out config files and scripts
23
+ // Filter out config files
6
24
  const configFiles = [
7
25
  '.lintstagedrc.js',
8
26
  '.eslintrc.js',
@@ -13,15 +31,17 @@ module.exports = {
13
31
  const filtered = filenames.filter(
14
32
  (f) =>
15
33
  !configFiles.some((config) => f.includes(config)) &&
16
- !f.includes('scripts/') &&
17
- !f.includes('test/'),
34
+ // For @diplodoc/lint package itself: exclude bin/ and scripts/ (in .eslintignore)
35
+ !(isLintPkg && (f.includes('bin/') || f.includes('scripts/'))),
18
36
  );
19
37
  if (filtered.length === 0) {
20
38
  return [];
21
39
  }
22
40
  return [
23
41
  ...filtered.map((f) => `prettier --write ${f}`),
24
- ...filtered.map((f) => `eslint --max-warnings=0 --fix ${f}`),
42
+ ...filtered.map(
43
+ (f) => `env ESLINT_USE_FLAT_CONFIG=false npx eslint --max-warnings=0 --fix ${f}`,
44
+ ),
25
45
  ];
26
46
  },
27
47
  // Handle .lintstagedrc.js separately (only prettier, no eslint)
@@ -1 +1,6 @@
1
+ // ⚠️ AUTO-GENERATED FILE - DO NOT EDIT MANUALLY
2
+ // This file is automatically generated and updated by `@diplodoc/lint update`
3
+ // Any manual changes will be overwritten on the next update
4
+ // To customize Prettier configuration, see: https://github.com/diplodoc-platform/lint#configuration
5
+
1
6
  module.exports = require('@diplodoc/lint/prettier-config');
@@ -1,3 +1,8 @@
1
+ // ⚠️ AUTO-GENERATED FILE - DO NOT EDIT MANUALLY
2
+ // This file is automatically generated and updated by `@diplodoc/lint update`
3
+ // Any manual changes will be overwritten on the next update
4
+ // To customize Stylelint configuration, see: https://github.com/diplodoc-platform/lint#configuration
5
+
1
6
  module.exports = {
2
7
  extends: require.resolve('@diplodoc/lint/stylelint-config'),
3
8
  };
@@ -1,5 +1,5 @@
1
1
  const {join} = require('node:path');
2
- const {readFileSync, writeFileSync} = require('node:fs');
2
+ const {readFileSync, writeFileSync, existsSync} = require('node:fs');
3
3
 
4
4
  const SYSTEM = [
5
5
  '.idea',
@@ -30,14 +30,13 @@ const ignores = {
30
30
  ...SYSTEM,
31
31
  ...INSTALL,
32
32
  ...ARTIFACTS,
33
- // Test files and scripts use Node.js globals
34
- 'test/',
35
- 'scripts/',
36
33
  // Config files use CommonJS
37
34
  '.lintstagedrc.js',
38
35
  '.eslintrc.js',
39
36
  '.prettierrc.js',
40
37
  '.stylelintrc.js',
38
+ // Build scripts that use newer syntax not yet supported by ESLint parser
39
+ 'esbuild/**/*.mjs',
41
40
  ],
42
41
  '.prettierignore': [
43
42
  ...SYSTEM,
@@ -32,27 +32,18 @@ const configContent = configTemplate
32
32
 
33
33
  const manifestContent = manifestTemplate
34
34
  .replace(/\{\{PACKAGE_VERSION\}\}/g, packageVersion)
35
- .trimEnd(); // Remove trailing whitespace/newlines
35
+ .trimEnd() + '\n'; // Remove trailing whitespace/newlines
36
36
 
37
37
  // Write files
38
38
  const configOutputPath = join(process.cwd(), '.release-please-config.json');
39
39
  const manifestOutputPath = join(process.cwd(), '.release-please-manifest.json');
40
40
 
41
- // Only create if they don't exist (preserve existing configs)
42
41
  if (!existsSync(configOutputPath)) {
43
- writeFileSync(configOutputPath, configContent, 'utf8');
44
42
  console.log('[@diplodoc/lint]', '=> Create .release-please-config.json');
45
- } else {
46
- console.log('[@diplodoc/lint]', '=> .release-please-config.json already exists, skipping');
43
+ writeFileSync(configOutputPath, configContent, 'utf8');
47
44
  }
48
45
 
49
- if (!existsSync(manifestOutputPath)) {
50
- writeFileSync(manifestOutputPath, manifestContent, 'utf8');
51
- console.log('[@diplodoc/lint]', '=> Create .release-please-manifest.json');
52
- } else {
53
- // Always update manifest with current version
54
- writeFileSync(manifestOutputPath, manifestContent, 'utf8');
55
- console.log('[@diplodoc/lint]', '=> Update .release-please-manifest.json');
56
- }
46
+ console.log('[@diplodoc/lint]', '=> Update .release-please-manifest.json');
47
+ writeFileSync(manifestOutputPath, manifestContent, 'utf8');
57
48
 
58
49