@diplodoc/lint 1.4.0 → 1.5.0

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/.eslintrc.js CHANGED
@@ -5,4 +5,12 @@ module.exports = {
5
5
  tsconfigRootDir: __dirname,
6
6
  project: true,
7
7
  },
8
+ overrides: [
9
+ {
10
+ files: ['*.mjs', '*.cjs'],
11
+ parserOptions: {
12
+ project: null,
13
+ },
14
+ },
15
+ ],
8
16
  };
package/.lintstagedrc.js CHANGED
@@ -18,8 +18,10 @@ module.exports = {
18
18
  if (filtered.length === 0) {
19
19
  return [];
20
20
  }
21
- return ['prettier --write', 'eslint --max-warnings=0 --fix --no-warn-ignored'];
21
+ return ['prettier --write', 'eslint --max-warnings=0 --fix'];
22
22
  },
23
+ // Handle .lintstagedrc.js separately (only prettier, no eslint)
24
+ '.lintstagedrc.js': ['prettier --write'],
23
25
  '**/*.{css,scss}': ['prettier --write', 'stylelint --fix'],
24
26
  '**/*.{json,yaml,yml,md}': ['prettier --write'],
25
27
  '**/*.{svg,svgx}': ['svgo'],
package/AGENTS.md CHANGED
@@ -246,12 +246,18 @@ The `bin/` directory contains executable scripts that are made available via npm
246
246
  **Default mode** (`lint`):
247
247
 
248
248
  - Runs ESLint on all JS/TS files (check only)
249
+ - Uses glob pattern `**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}`
250
+ - ESLint automatically respects `.eslintignore` file
251
+ - No manual file filtering needed
249
252
  - Runs Prettier in check mode on all JS/TS files
250
253
  - Runs Stylelint on CSS/SCSS files (if found and not ignored)
251
254
 
252
255
  **Fix mode** (`lint fix`):
253
256
 
254
257
  - Runs ESLint with `--fix` flag (auto-fixes issues)
258
+ - Uses glob pattern `**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}`
259
+ - ESLint automatically respects `.eslintignore` file
260
+ - No manual file filtering needed
255
261
  - Runs Prettier with `--write` flag (formats files)
256
262
  - Runs Stylelint with `--fix` flag (auto-fixes CSS issues)
257
263
 
@@ -260,6 +266,8 @@ The `bin/` directory contains executable scripts that are made available via npm
260
266
  1. **Modify package.json**: Adds/updates lint scripts via `scripts/modify-package.js`
261
267
  2. **Initialize Husky**: Runs `husky init` (only on `init`)
262
268
  3. **Copy scaffolding**: Copies all files from `scaffolding/` directory to package root
269
+ - Configuration files (`.eslintrc.js`, `.prettierrc.js`, etc.)
270
+ - **GitHub Actions workflows** (`.github/workflows/*.yml`)
263
271
  4. **Update ignore files**: Extends `.gitignore`, `.eslintignore`, `.prettierignore`, `.stylelintignore` via `scripts/modify-ignore.js`
264
272
 
265
273
  ### Infrastructure Auto-Update
@@ -299,8 +307,10 @@ When a package uses `@diplodoc/lint`:
299
307
  - Creates `.husky/` directory
300
308
  - Sets up git hooks
301
309
  - **Step 3**: Copies scaffolding files from `scaffolding/` to package root
302
- - `.eslintrc.js`, `.prettierrc.js`, `.stylelintrc.js`
303
- - `.lintstagedrc.js`, `.husky/pre-commit`
310
+ - Configuration files: `.eslintrc.js`, `.prettierrc.js`, `.stylelintrc.js`
311
+ - Git hooks: `.lintstagedrc.js`, `.husky/pre-commit`
312
+ - Editor config: `.editorconfig`
313
+ - **GitHub Actions workflows**: `.github/workflows/tests.yml`, `.github/workflows/release.yml`, `.github/workflows/security.yml`
304
314
  - **Step 4**: Updates ignore files via `scripts/modify-ignore.js`
305
315
  - Extends `.gitignore`, `.eslintignore`, `.prettierignore`, `.stylelintignore`
306
316
  - Adds standard patterns (system files, build artifacts, node_modules)
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.5.0](https://github.com/diplodoc-platform/lint/compare/v1.4.1...v1.5.0) (2025-12-26)
4
+
5
+
6
+ ### Features
7
+
8
+ * add GitHub Actions workflows to scaffolding ([315614e](https://github.com/diplodoc-platform/lint/commit/315614eb288a448ffe45953b4294226b394bcfb3))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * improve workflow copying to avoid overwriting existing workflows ([2245114](https://github.com/diplodoc-platform/lint/commit/224511473f253283a29868fdd0669554f823146f))
14
+ * prevent overwriting existing workflows during scaffolding copy ([777a7ad](https://github.com/diplodoc-platform/lint/commit/777a7ade09b8af8d43ef789cc213147c9ae9626e))
15
+ * simplify workflow copying logic ([0d6cb67](https://github.com/diplodoc-platform/lint/commit/0d6cb67cfb22273ed84d23dc387e4510a5e9e39c))
16
+ * update release.yml to publish only on release events ([024dc38](https://github.com/diplodoc-platform/lint/commit/024dc38cfcd2a7338fabcb5d43d88edfca00b15e))
17
+ * use cross-platform file copying in bin/lint ([3cad582](https://github.com/diplodoc-platform/lint/commit/3cad582177f900fe8fcdb50cff9f825904dae7f3))
18
+
19
+ ## [1.4.1](https://github.com/diplodoc-platform/lint/compare/v1.4.0...v1.4.1) (2025-12-26)
20
+
21
+
22
+ ### Bug Fixes
23
+
24
+ * remove invalid --no-warn-ignored flag from ESLint command ([1fc9a67](https://github.com/diplodoc-platform/lint/commit/1fc9a670056054dbedce90613f8c52111a1350ea))
25
+ * remove invalid --no-warn-ignored flag from ESLint commands ([644e271](https://github.com/diplodoc-platform/lint/commit/644e27123985ea2c078ffd4f632b9e4252f1a24c))
26
+
3
27
  ## [1.4.0](https://github.com/diplodoc-platform/lint/compare/v1.3.3...v1.4.0) (2025-12-26)
4
28
 
5
29
 
package/bin/lint CHANGED
@@ -29,7 +29,34 @@ if [[ -n "$INIT$UPDATE" ]]; then
29
29
  fi
30
30
 
31
31
  echo "[@diplodoc/lint] Add initial lint configs"
32
+ # Copy all scaffolding files except .github/workflows (handled separately)
33
+ if [[ -d "$SRCDIR/scaffolding/.github/workflows" ]]; then
34
+ # Temporarily move workflows out of the way
35
+ mkdir -p /tmp/lint-scaffolding-workflows
36
+ mv "$SRCDIR/scaffolding/.github/workflows" /tmp/lint-scaffolding-workflows/
37
+ fi
38
+
32
39
  cp -a "$SRCDIR/scaffolding/." .
40
+
41
+ # Restore workflows in scaffolding
42
+ if [[ -d /tmp/lint-scaffolding-workflows/workflows ]]; then
43
+ mv /tmp/lint-scaffolding-workflows/workflows "$SRCDIR/scaffolding/.github/workflows"
44
+ rmdir /tmp/lint-scaffolding-workflows 2>/dev/null || true
45
+ fi
46
+
47
+ echo "[@diplodoc/lint] Add GitHub Actions workflows"
48
+ if [[ -d "$SRCDIR/scaffolding/.github/workflows" ]]; then
49
+ mkdir -p .github/workflows
50
+ # Only copy workflows that don't exist yet (don't overwrite existing)
51
+ for workflow in "$SRCDIR/scaffolding/.github/workflows"/*.yml; do
52
+ if [[ -f "$workflow" ]]; then
53
+ workflow_name=$(basename "$workflow")
54
+ if [[ ! -f ".github/workflows/$workflow_name" ]]; then
55
+ cp "$workflow" ".github/workflows/$workflow_name"
56
+ fi
57
+ fi
58
+ done
59
+ fi
33
60
 
34
61
  echo "[@diplodoc/lint] Extend .ignore configuration"
35
62
  node "$SRCDIR/scripts/modify-ignore.js"
@@ -40,12 +67,7 @@ fi
40
67
  if [[ -n $FIX ]]; then
41
68
  echo "Run linters in fix mode"
42
69
 
43
- # Filter files using .eslintignore before passing to ESLint
44
- if [[ -f .eslintignore ]]; then
45
- find . -type f \( -name '*.js' -o -name '*.mjs' -o -name '*.cjs' -o -name '*.jsx' -o -name '*.ts' -o -name '*.mts' -o -name '*.cts' -o -name '*.tsx' \) ! -path '*/node_modules/*' | grep -vwFf .eslintignore | xargs $BINDIR/eslint --fix --no-warn-ignored || exit 1
46
- else
47
- $BINDIR/eslint '**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}' --fix
48
- fi
70
+ $BINDIR/eslint '**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}' --fix
49
71
  $BINDIR/prettier --write '**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}'
50
72
  if [[ -n $(find . -type f -name '*.css' -name '*.scss' | grep -vwFf .stylelintignore) ]]; then
51
73
  $BINDIR/stylelint '**/*.{css,scss}' --fix
@@ -56,13 +78,7 @@ fi
56
78
 
57
79
  echo "Run linters"
58
80
 
59
- # Filter files using .eslintignore before passing to ESLint
60
- # This ensures ignorePatterns and .eslintignore are respected
61
- if [[ -f .eslintignore ]]; then
62
- find . -type f \( -name '*.js' -o -name '*.mjs' -o -name '*.cjs' -o -name '*.jsx' -o -name '*.ts' -o -name '*.mts' -o -name '*.cts' -o -name '*.tsx' \) ! -path '*/node_modules/*' | grep -vwFf .eslintignore | xargs $BINDIR/eslint --no-warn-ignored || exit 1
63
- else
64
- $BINDIR/eslint '**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}'
65
- fi
81
+ $BINDIR/eslint '**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}'
66
82
  $BINDIR/prettier --check '**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}'
67
83
  if [[ -n $(find . -type f -name '*.css' -name '*.scss' | grep -vwFf .stylelintignore) ]]; then
68
84
  $BINDIR/stylelint '**/*.{css,scss}'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diplodoc/lint",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "Diplodoc platform internal utility set for linting",
5
5
  "bin": {
6
6
  "lint": "./bin/lint",
@@ -18,7 +18,7 @@ module.exports = {
18
18
  if (filtered.length === 0) {
19
19
  return [];
20
20
  }
21
- return ['prettier --write', 'eslint --max-warnings=0 --fix --no-warn-ignored'];
21
+ return ['prettier --write', 'eslint --max-warnings=0 --fix'];
22
22
  },
23
23
  // Handle .lintstagedrc.js separately (only prettier, no eslint)
24
24
  '.lintstagedrc.js': ['prettier --write'],