Skip to content

Commit 285b6ec

Browse files
authored
fix(eslint-config): oxlint will exit with non-zero if all linting files are not supported (#20)
1 parent 244b194 commit 285b6ec

3 files changed

Lines changed: 11 additions & 2 deletions

File tree

docs/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
"dom.iterable",
99
"esnext"
1010
],
11-
"baseUrl": ".",
1211
"module": "esnext",
1312
"moduleResolution": "bundler",
1413
"paths": {
@@ -25,6 +24,8 @@
2524
"noEmit": true,
2625
"esModuleInterop": true,
2726
"forceConsistentCasingInFileNames": true,
27+
// https://stackoverflow.com/a/79878514
28+
"noUncheckedSideEffectImports": false,
2829
"isolatedModules": true,
2930
"skipLibCheck": true,
3031
"plugins": [

packages/eslint-config/src/moeru-lint.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,12 @@ else {
6363
const fixSuggestions = values['fix-suggestions'] ? '--fix-suggestions' : ''
6464
const cache = values['no-cache'] ? '' : '--cache'
6565

66-
const oxcArgs = [fix, fixDangerously, fixSuggestions, ...paths].filter(v => v.length > 0)
66+
// NOTICE: since oxlint cannot handle unsupported file paths, if
67+
// the committing files are all unsupported file paths (updating package.json, or flushing
68+
// i18n, lock files), oxlint will exit with a non-zero exit code before eslint is executed.
69+
//
70+
// To avoid this, we add the `--no-error-on-unmatched-pattern` flag to oxlint.
71+
const oxcArgs = ['--no-error-on-unmatched-pattern', fix, fixDangerously, fixSuggestions, ...paths].filter(v => v.length > 0)
6772
const eslintArgs = [fix, cache, ...paths].filter(v => v.length > 0)
6873
const eslintFlags = values.flag?.join(',')
6974

tsconfig.lib.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
"extends": "@moeru/tsconfig",
33
"compilerOptions": {
4+
"types": [
5+
"node"
6+
],
47
"allowJs": true,
58
"checkJs": true
69
},

0 commit comments

Comments
 (0)