@diplodoc/lint 1.10.1 → 1.10.3
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/.husky/commit-msg +6 -6
- package/.lintstagedrc.js +6 -7
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +16 -0
- package/bin/lint.js +6 -4
- package/package.json +1 -1
- package/scaffolding/.husky/commit-msg +3 -3
- package/scaffolding/.lintstagedrc.js +6 -7
package/.husky/commit-msg
CHANGED
|
@@ -3,7 +3,7 @@ COMMIT_MSG=$(cat "$COMMIT_MSG_FILE")
|
|
|
3
3
|
|
|
4
4
|
# Check if commit message contains Cyrillic characters
|
|
5
5
|
# All commit messages must be in English per .agents/style-and-testing.md
|
|
6
|
-
if echo "$COMMIT_MSG" | grep -q '[А-Яа-яЁё]'; then
|
|
6
|
+
if echo "$COMMIT_MSG" | LC_ALL=C grep -q '[А-Яа-яЁё]'; then
|
|
7
7
|
echo "❌ Error: Commit message contains Cyrillic characters."
|
|
8
8
|
echo ""
|
|
9
9
|
echo "All commit messages must be in English per .agents/style-and-testing.md"
|
|
@@ -18,23 +18,23 @@ fi
|
|
|
18
18
|
SUBJECT=$(echo "$COMMIT_MSG" | head -n1)
|
|
19
19
|
|
|
20
20
|
# Allow fixup! and squash! prefixes (for git commit --fixup and --squash)
|
|
21
|
-
if echo "$SUBJECT" | grep -qE '^(fixup!|squash!)'; then
|
|
21
|
+
if echo "$SUBJECT" | LC_ALL=C grep -qE '^(fixup!|squash!)'; then
|
|
22
22
|
exit 0
|
|
23
23
|
fi
|
|
24
24
|
|
|
25
25
|
# Check Conventional Commits format: <type>(<scope>): <subject>
|
|
26
|
-
# Types: feat, fix, perf, refactor, docs, chore, revert
|
|
26
|
+
# Types: feat, fix, perf, refactor, docs, chore, revert, deps
|
|
27
27
|
# Scope is optional
|
|
28
|
-
if ! echo "$SUBJECT" | grep -qE '^(feat|fix|perf|refactor|docs|chore|revert)(\([^)]+\))?: .+'; then
|
|
28
|
+
if ! echo "$SUBJECT" | LC_ALL=C grep -qE '^(feat|fix|perf|refactor|docs|chore|revert|deps)(\([^)]+\))?: .+'; then
|
|
29
29
|
echo "❌ Error: Commit message does not follow Conventional Commits format."
|
|
30
30
|
echo ""
|
|
31
31
|
echo "Expected format: <type>(<scope>): <subject>"
|
|
32
32
|
echo ""
|
|
33
|
-
echo "Types: feat, fix, perf, refactor, docs, chore, revert"
|
|
33
|
+
echo "Types: feat, fix, perf, refactor, docs, chore, revert, deps"
|
|
34
34
|
echo "Scope is optional"
|
|
35
35
|
echo ""
|
|
36
36
|
echo "Examples:"
|
|
37
|
-
echo " feat(
|
|
37
|
+
echo " feat(lint): add new command"
|
|
38
38
|
echo " fix(transform): handle edge case"
|
|
39
39
|
echo " docs(readme): update installation"
|
|
40
40
|
echo ""
|
package/.lintstagedrc.js
CHANGED
|
@@ -37,20 +37,19 @@ module.exports = {
|
|
|
37
37
|
if (filtered.length === 0) {
|
|
38
38
|
return [];
|
|
39
39
|
}
|
|
40
|
+
|
|
40
41
|
return [
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
(f) => `env ESLINT_USE_FLAT_CONFIG=false npx eslint --max-warnings=0 --fix ${f}`,
|
|
44
|
-
),
|
|
42
|
+
`prettier --write ${filtered.join(' ')}`,
|
|
43
|
+
`env ESLINT_USE_FLAT_CONFIG=false npx eslint --max-warnings=0 --fix`,
|
|
45
44
|
];
|
|
46
45
|
},
|
|
47
46
|
// Handle .lintstagedrc.js separately (only prettier, no eslint)
|
|
48
47
|
'.lintstagedrc.js': (filenames) => filenames.map((f) => `prettier --write ${f}`),
|
|
49
48
|
'**/*.{css,scss}': (filenames) => [
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
`prettier --write ${filenames.join(' ')}`,
|
|
50
|
+
`stylelint --fix ${filenames.join(' ')}`,
|
|
52
51
|
],
|
|
53
|
-
'**/*.{json,yaml,yml,md}': (filenames) =>
|
|
52
|
+
'**/*.{json,yaml,yml,md}': (filenames) => `prettier --write ${filenames.join(' ')}`,
|
|
54
53
|
'**/*.{svg,svgx}': ['svgo'],
|
|
55
54
|
// Run unit tests when test files or source files change
|
|
56
55
|
'**/*.{ts,tsx}': (filenames) => {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.10.3](https://github.com/diplodoc-platform/lint/compare/v1.10.2...v1.10.3) (2026-01-28)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* Add warning to autogenerated files ([3f394fa](https://github.com/diplodoc-platform/lint/commit/3f394fa9800fc622d006d12257819f7bf1a562ba))
|
|
9
|
+
* Fix linstaged filters ([16d2b12](https://github.com/diplodoc-platform/lint/commit/16d2b12446c059db3040a7fd3f566da39d8dbbdb))
|
|
10
|
+
* **lint:** simplify stylelint execution and improve hasStyleFiles ([7e37390](https://github.com/diplodoc-platform/lint/commit/7e373900d764e58abe543bd6c837e94c073eb56e))
|
|
11
|
+
|
|
12
|
+
## [1.10.2](https://github.com/diplodoc-platform/lint/compare/v1.10.1...v1.10.2) (2026-01-22)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* **lint:** prevent stylelint hang in large projects ([8799514](https://github.com/diplodoc-platform/lint/commit/8799514e6149b21436ba5350e19d05e9f09cf591))
|
|
18
|
+
|
|
3
19
|
## [1.10.1](https://github.com/diplodoc-platform/lint/compare/v1.10.0...v1.10.1) (2026-01-22)
|
|
4
20
|
|
|
5
21
|
|
package/bin/lint.js
CHANGED
|
@@ -48,9 +48,11 @@ function execCommand(cmd, options = {}) {
|
|
|
48
48
|
|
|
49
49
|
function hasStyleFiles() {
|
|
50
50
|
try {
|
|
51
|
+
// Quick check if there are any style files (excluding common ignored directories)
|
|
52
|
+
// This prevents hanging when scanning large projects
|
|
51
53
|
const result = execSync(
|
|
52
|
-
`find . -type f \\( -name '*.css' -o -name '*.scss' \\)
|
|
53
|
-
{shell: shell, cwd: process.cwd(), encoding: 'utf8', stdio: 'pipe'},
|
|
54
|
+
`find . -type f \\( -name '*.css' -o -name '*.scss' \\) ! -path '*/node_modules/*' ! -path '*/build/*' ! -path '*/lib/*' ! -path '*/dist/*' ! -path '*/cache/*' ! -path '*/coverage/*' ! -path '*/.git/*' 2>/dev/null | head -1`,
|
|
55
|
+
{shell: shell, cwd: process.cwd(), encoding: 'utf8', stdio: 'pipe', timeout: 5000},
|
|
54
56
|
);
|
|
55
57
|
return result && result.trim().length > 0;
|
|
56
58
|
} catch {
|
|
@@ -96,7 +98,7 @@ if (fix) {
|
|
|
96
98
|
execCommand(`"${join(binDir, 'prettier')}" --write '**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}'`);
|
|
97
99
|
|
|
98
100
|
if (hasStyleFiles()) {
|
|
99
|
-
execCommand(`"${join(binDir, 'stylelint')}" '**/*.{css,scss}' --fix`);
|
|
101
|
+
execCommand(`"${join(binDir, 'stylelint')}" '**/*.{css,scss}' --fix --ignore-path .stylelintignore --allow-empty-input`);
|
|
100
102
|
}
|
|
101
103
|
|
|
102
104
|
process.exit(0);
|
|
@@ -115,6 +117,6 @@ if (fix) {
|
|
|
115
117
|
execCommand(`"${join(binDir, 'prettier')}" --check '**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}'`);
|
|
116
118
|
|
|
117
119
|
if (hasStyleFiles()) {
|
|
118
|
-
execCommand(`"${join(binDir, 'stylelint')}" '**/*.{css,scss}'`);
|
|
120
|
+
execCommand(`"${join(binDir, 'stylelint')}" '**/*.{css,scss}' --ignore-path .stylelintignore --allow-empty-input`);
|
|
119
121
|
}
|
|
120
122
|
}
|
package/package.json
CHANGED
|
@@ -23,14 +23,14 @@ if echo "$SUBJECT" | grep -qE '^(fixup!|squash!)'; then
|
|
|
23
23
|
fi
|
|
24
24
|
|
|
25
25
|
# Check Conventional Commits format: <type>(<scope>): <subject>
|
|
26
|
-
# Types: feat, fix, perf, refactor, docs, chore, revert
|
|
26
|
+
# Types: feat, fix, perf, refactor, docs, chore, revert, deps
|
|
27
27
|
# Scope is optional
|
|
28
|
-
if ! echo "$SUBJECT" | grep -qE '^(feat|fix|perf|refactor|docs|chore|revert)(\([^)]+\))?: .+'; then
|
|
28
|
+
if ! echo "$SUBJECT" | grep -qE '^(feat|fix|perf|refactor|docs|chore|revert|deps)(\([^)]+\))?: .+'; then
|
|
29
29
|
echo "❌ Error: Commit message does not follow Conventional Commits format."
|
|
30
30
|
echo ""
|
|
31
31
|
echo "Expected format: <type>(<scope>): <subject>"
|
|
32
32
|
echo ""
|
|
33
|
-
echo "Types: feat, fix, perf, refactor, docs, chore, revert"
|
|
33
|
+
echo "Types: feat, fix, perf, refactor, docs, chore, revert, deps"
|
|
34
34
|
echo "Scope is optional"
|
|
35
35
|
echo ""
|
|
36
36
|
echo "Examples:"
|
|
@@ -37,20 +37,19 @@ module.exports = {
|
|
|
37
37
|
if (filtered.length === 0) {
|
|
38
38
|
return [];
|
|
39
39
|
}
|
|
40
|
+
|
|
40
41
|
return [
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
(f) => `env ESLINT_USE_FLAT_CONFIG=false npx eslint --max-warnings=0 --fix ${f}`,
|
|
44
|
-
),
|
|
42
|
+
`prettier --write ${filtered.join(' ')}`,
|
|
43
|
+
`env ESLINT_USE_FLAT_CONFIG=false npx eslint --max-warnings=0 --fix`,
|
|
45
44
|
];
|
|
46
45
|
},
|
|
47
46
|
// Handle .lintstagedrc.js separately (only prettier, no eslint)
|
|
48
47
|
'.lintstagedrc.js': (filenames) => filenames.map((f) => `prettier --write ${f}`),
|
|
49
48
|
'**/*.{css,scss}': (filenames) => [
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
`prettier --write ${filenames.join(' ')}`,
|
|
50
|
+
`stylelint --fix ${filenames.join(' ')}`,
|
|
52
51
|
],
|
|
53
|
-
'**/*.{json,yaml,yml,md}': (filenames) =>
|
|
52
|
+
'**/*.{json,yaml,yml,md}': (filenames) => `prettier --write ${filenames.join(' ')}`,
|
|
54
53
|
'**/*.{svg,svgx}': ['svgo'],
|
|
55
54
|
// Run unit tests when test files or source files change
|
|
56
55
|
'**/*.{ts,tsx}': (filenames) => {
|