@lbenie/linting 1.8.0 → 1.8.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/eslint/eslint.config.js +22 -4
- package/package.json +1 -1
package/eslint/eslint.config.js
CHANGED
|
@@ -9,6 +9,7 @@ import prettier from 'eslint-plugin-prettier'
|
|
|
9
9
|
import astroParser from 'astro-eslint-parser'
|
|
10
10
|
import astro from 'eslint-plugin-astro'
|
|
11
11
|
import litA11y from 'eslint-plugin-lit-a11y'
|
|
12
|
+
import { existsSync } from 'node:fs'
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* @type {Pick<import('eslint').Linter.FlatConfig, 'parserOptions' | 'ignores' | 'languageOptions'>}
|
|
@@ -86,11 +87,28 @@ const tsRules = {
|
|
|
86
87
|
const defaultRules = {
|
|
87
88
|
...functionalrules,
|
|
88
89
|
...prettierRules,
|
|
89
|
-
...jsxA11y.
|
|
90
|
+
...jsxA11y.flatConfigs.recommended,
|
|
90
91
|
...litA11y.configs.recommended.rules,
|
|
91
92
|
}
|
|
92
93
|
|
|
93
|
-
|
|
94
|
+
/**
|
|
95
|
+
* @type {import('@typescript-eslint/parser').ParserOptions['project']}
|
|
96
|
+
* @returns {string[]} an array of paths to tsconfig files
|
|
97
|
+
*/
|
|
98
|
+
const defaultTsProjects = () => {
|
|
99
|
+
const paths = []
|
|
100
|
+
|
|
101
|
+
if (existsSync('./tsconfig.json')) {
|
|
102
|
+
paths.push('./tsconfig.json')
|
|
103
|
+
}
|
|
104
|
+
if (existsSync('./tsconfig.spec.json')) {
|
|
105
|
+
paths.push('./tsconfig.spec.json')
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return paths
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const project = defaultTsProjects()
|
|
94
112
|
|
|
95
113
|
/**
|
|
96
114
|
* @type {import('eslint').Linter.FlatConfig[]}
|
|
@@ -123,7 +141,7 @@ const config = [
|
|
|
123
141
|
parserOptions: {
|
|
124
142
|
...defaultOptions.languageOptions.parserOptions,
|
|
125
143
|
parser: typescriptParser,
|
|
126
|
-
project
|
|
144
|
+
project,
|
|
127
145
|
},
|
|
128
146
|
},
|
|
129
147
|
plugins: {
|
|
@@ -143,7 +161,7 @@ const config = [
|
|
|
143
161
|
parserOptions: {
|
|
144
162
|
...defaultOptions.languageOptions.parserOptions,
|
|
145
163
|
parser: typescriptParser,
|
|
146
|
-
project
|
|
164
|
+
project,
|
|
147
165
|
},
|
|
148
166
|
},
|
|
149
167
|
rules: {
|