@blacklizard/eslint-blacklizard 1.0.0 → 2.0.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/CHANGELOG.md +71 -0
- package/README.md +29 -11
- package/eslint.config.mjs +146 -18
- package/package.json +34 -15
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# @blacklizard/eslint-blacklizard
|
|
2
|
+
|
|
3
|
+
## 2.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- d7cb9bb: Fix two config defects that changed what consumers were actually linting.
|
|
8
|
+
|
|
9
|
+
Modern syntax now parses. `eslint-config-airbnb-extended` pins
|
|
10
|
+
`parserOptions.ecmaVersion` to 2018, and espree honours that over
|
|
11
|
+
`languageOptions.ecmaVersion`, so optional chaining, nullish coalescing, class
|
|
12
|
+
fields, top-level await and `import.meta` were all fatal parse errors in
|
|
13
|
+
`.js`, `.mjs`, `.cjs` and `.jsx`. A scoped override restores `latest`.
|
|
14
|
+
|
|
15
|
+
Vue SFCs are no longer configured as CommonJS. The `.vue` glob was appended to
|
|
16
|
+
every entry that was not JavaScript-only, including airbnb's CommonJS entry
|
|
17
|
+
scoped to `.cjs`/`.cts`. SFCs resolved with `require` and `module` as globals
|
|
18
|
+
and `n/no-unsupported-features/es-syntax` set to reject ESM syntax. Entries
|
|
19
|
+
that configure a specific module system are now left alone, and `.cjs` and
|
|
20
|
+
`.mjs` keep their own configuration.
|
|
21
|
+
|
|
22
|
+
Both are covered by regression tests, each verified to fail without its fix.
|
|
23
|
+
|
|
24
|
+
Also hardened: `@stylistic/eslint-plugin` is a declared dependency instead of
|
|
25
|
+
being reached through airbnb-extended's internals; plugin configs that stop
|
|
26
|
+
being flat-config objects now throw at load rather than silently linting
|
|
27
|
+
nothing; and the eta tag regex no longer shares `lastIndex` between files.
|
|
28
|
+
|
|
29
|
+
- dc06455: Require ESLint 10.
|
|
30
|
+
|
|
31
|
+
`peerDependencies.eslint` moves from `>=9` to `>=10` and `@eslint/js` bumps to
|
|
32
|
+
`^10`, which adds three rules to `js.configs.recommended` — `no-unassigned-vars`,
|
|
33
|
+
`no-useless-assignment` and `preserve-caught-error`. Existing code may report new
|
|
34
|
+
errors under these.
|
|
35
|
+
|
|
36
|
+
`typescript` and `tailwindcss` are now declared as optional peer dependencies so
|
|
37
|
+
consumers control those versions instead of resolving them transitively.
|
|
38
|
+
|
|
39
|
+
All plugin dependencies bumped to their latest releases: `@eslint/css` 1.4,
|
|
40
|
+
`@html-eslint/*` 0.64, `@typescript-eslint/parser` 8.65,
|
|
41
|
+
`eslint-config-airbnb-extended` 3.1.1, `eslint-plugin-better-tailwindcss` 4.7,
|
|
42
|
+
`eslint-plugin-vue` 10.10, `vue-eslint-parser` 10.4.1.
|
|
43
|
+
|
|
44
|
+
### Patch Changes
|
|
45
|
+
|
|
46
|
+
- 8d3cd3b: Make a consumer's own `eslint.config.mjs` lint clean under this config.
|
|
47
|
+
|
|
48
|
+
Tool config files may import devDependencies wherever they live.
|
|
49
|
+
airbnb-extended already allows them in `eslint.config.*`, `vite.config.*`,
|
|
50
|
+
test files and the like, but import-x matches those globs without `dot`, so
|
|
51
|
+
`**` never crossed a dot-directory: a config file under `.config/` or
|
|
52
|
+
`.claude/worktrees/`, or in any project whose absolute path has one when ESLint
|
|
53
|
+
runs from outside it, was reported by `import-x/no-extraneous-dependencies`.
|
|
54
|
+
airbnb's glob list is now re-applied through ESLint's own dot-safe matcher.
|
|
55
|
+
|
|
56
|
+
`import config from '@blacklizard/eslint-blacklizard'` no longer warns
|
|
57
|
+
`import-x/no-rename-default`. With a linked or workspace install, the default
|
|
58
|
+
import warned under any name but `autoConfig`, and `import autoConfig` errored
|
|
59
|
+
`import-x/no-named-as-default`. The default is the same array as before,
|
|
60
|
+
exported through a binding named `config`.
|
|
61
|
+
|
|
62
|
+
The README examples now import, then `export default`: the documented
|
|
63
|
+
`export { default } from '@blacklizard/eslint-blacklizard'` one-liner failed
|
|
64
|
+
`no-restricted-exports` in every project. A test lints each README example so
|
|
65
|
+
they stay correct.
|
|
66
|
+
|
|
67
|
+
## 1.0.1
|
|
68
|
+
|
|
69
|
+
### Patch Changes
|
|
70
|
+
|
|
71
|
+
- Allow manual trigger of the publish workflow via workflow_dispatch.
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Reusable, opinionated ESLint config — Blacklizard code standards. Built on
|
|
4
4
|
[`eslint-config-airbnb-extended`](https://www.npmjs.com/package/eslint-config-airbnb-extended),
|
|
5
|
-
flat config, ESLint
|
|
5
|
+
flat config, ESLint 10+.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -10,7 +10,18 @@ flat config, ESLint 9+.
|
|
|
10
10
|
pnpm add -D eslint @blacklizard/eslint-blacklizard
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
`eslint` is a peer dependency (`>=
|
|
13
|
+
`eslint` is a peer dependency (`>=10`). Requires Node `>=24`.
|
|
14
|
+
|
|
15
|
+
`typescript` (`>=4.8.4 <6.1.0`) and `tailwindcss` (`^3.3.0 || ^4.1.17`) are
|
|
16
|
+
optional peer dependencies — install them only if you lint TypeScript or
|
|
17
|
+
Tailwind classes. Every ESLint plugin this config uses ships as a regular
|
|
18
|
+
dependency, so nothing else needs installing.
|
|
19
|
+
|
|
20
|
+
`pnpm install` prints unmet-peer warnings for `eslint-config-airbnb-extended`,
|
|
21
|
+
`eslint-plugin-import`, `eslint-plugin-jsx-a11y` and `eslint-plugin-react`,
|
|
22
|
+
which still declare `eslint@^9`. They are cosmetic: the last three are never
|
|
23
|
+
loaded by this config (it uses `import-x` and ships no React or a11y rules),
|
|
24
|
+
and airbnb-extended's flat configs run unchanged on ESLint 10.
|
|
14
25
|
|
|
15
26
|
## Usage
|
|
16
27
|
|
|
@@ -20,20 +31,25 @@ the right rules with no manual selection:
|
|
|
20
31
|
|
|
21
32
|
```js
|
|
22
33
|
// eslint.config.mjs — lints everything
|
|
23
|
-
|
|
34
|
+
import config from '@blacklizard/eslint-blacklizard';
|
|
35
|
+
|
|
36
|
+
export default config;
|
|
24
37
|
```
|
|
25
38
|
|
|
26
39
|
That is all most projects need. The individual configs are also exported if
|
|
27
|
-
you want to lint only
|
|
40
|
+
you want to lint only some file types — swap `vueConfig` for
|
|
41
|
+
`typescriptConfig`, `htmlConfig`, `cssConfig` or `etaConfig`:
|
|
28
42
|
|
|
29
43
|
```js
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
export
|
|
34
|
-
export { etaConfig as default } from '@blacklizard/eslint-blacklizard';
|
|
44
|
+
// eslint.config.mjs — lints .js, .ts and .vue only
|
|
45
|
+
import { vueConfig } from '@blacklizard/eslint-blacklizard';
|
|
46
|
+
|
|
47
|
+
export default vueConfig;
|
|
35
48
|
```
|
|
36
49
|
|
|
50
|
+
Import, then `export default` — the one-line re-export
|
|
51
|
+
(`export { default } from …`) fails this config's own `no-restricted-exports`.
|
|
52
|
+
|
|
37
53
|
To extend a config with project-specific rules:
|
|
38
54
|
|
|
39
55
|
```js
|
|
@@ -60,7 +76,9 @@ export default [
|
|
|
60
76
|
| `etaConfig` | `.eta` | JS inside `<% %>` exec tags of Eta templates |
|
|
61
77
|
| `cssConfig` | `.css` | `@eslint/css` recommended rules |
|
|
62
78
|
|
|
63
|
-
`default` is `autoConfig`.
|
|
79
|
+
`default` is `autoConfig`. Import it as `config`, or by name as
|
|
80
|
+
`{ autoConfig }` — `import autoConfig from …` trips
|
|
81
|
+
`import-x/no-named-as-default`, since that name is also a named export.
|
|
64
82
|
|
|
65
83
|
## Notable rule choices
|
|
66
84
|
|
|
@@ -122,7 +140,7 @@ Versioning is managed with [changesets](https://github.com/changesets/changesets
|
|
|
122
140
|
|
|
123
141
|
```sh
|
|
124
142
|
pnpm changeset # 1. record a change + pick bump type (patch/minor/major)
|
|
125
|
-
pnpm version
|
|
143
|
+
pnpm run version # 2. apply bumps, write CHANGELOG.md (`run` needed: bare `pnpm version` is a pnpm built-in)
|
|
126
144
|
git commit -am "version packages" # 3. commit the bump
|
|
127
145
|
pnpm release # 4. lint + test, then tag + push
|
|
128
146
|
```
|
package/eslint.config.mjs
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs';
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
2
3
|
import path from 'node:path';
|
|
3
4
|
|
|
4
5
|
import { includeIgnoreFile } from '@eslint/compat';
|
|
5
6
|
import cssPlugin from '@eslint/css';
|
|
6
7
|
import js from '@eslint/js';
|
|
7
8
|
import htmlPlugin from '@html-eslint/eslint-plugin';
|
|
9
|
+
import stylistic from '@stylistic/eslint-plugin';
|
|
8
10
|
import tsParser from '@typescript-eslint/parser';
|
|
9
11
|
import { defineConfig } from 'eslint/config';
|
|
10
12
|
import { configs, plugins, rules } from 'eslint-config-airbnb-extended';
|
|
11
13
|
import betterTailwind from 'eslint-plugin-better-tailwindcss';
|
|
12
14
|
import pluginVue from 'eslint-plugin-vue';
|
|
13
15
|
|
|
16
|
+
// Read via createRequire rather than an import attribute: this file ships as
|
|
17
|
+
// the package entry point, and import attributes are ES2025 syntax that older
|
|
18
|
+
// parsers in consumer toolchains still reject.
|
|
19
|
+
const packageJson = createRequire(import.meta.url)('./package.json');
|
|
20
|
+
|
|
14
21
|
const gitignorePath = path.resolve('.', '.gitignore');
|
|
15
22
|
// eslint-disable-next-line n/no-sync -- config loads synchronously at startup
|
|
16
23
|
const gitignoreConfig = existsSync(gitignorePath)
|
|
@@ -28,13 +35,47 @@ const SCRIPT_FILES = [
|
|
|
28
35
|
VUE_GLOB,
|
|
29
36
|
];
|
|
30
37
|
|
|
38
|
+
const JS_EXTENSIONS = new Set(['.js', '.cjs', '.mjs', '.jsx']);
|
|
39
|
+
|
|
40
|
+
// Every extension a glob can match: '**/*.{js,mjs}' yields ['.js', '.mjs'],
|
|
41
|
+
// '**/*.ts' yields ['.ts']. Brace lists have to be expanded rather than
|
|
42
|
+
// pattern-matched, or a mixed list like '**/*.{js,ts}' reads as JavaScript.
|
|
43
|
+
const globExtensions = (glob) => {
|
|
44
|
+
const braced = /\.\{([^{}]+)\}$/.exec(glob);
|
|
45
|
+
|
|
46
|
+
if (braced === null) {
|
|
47
|
+
return [path.extname(glob)];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return braced[1].split(',').map((extension) => `.${extension.trim()}`);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
// True when an entry targets plain JavaScript and nothing else. Guards the
|
|
54
|
+
// scope rewrites below: an upstream entry that deliberately covers only JS
|
|
55
|
+
// must not be widened onto TypeScript or .vue files.
|
|
31
56
|
const isJsOnly = (entry) => Array.isArray(entry.files)
|
|
32
|
-
&& entry.files.
|
|
57
|
+
&& entry.files.length > 0
|
|
58
|
+
&& entry.files.flat().every(
|
|
59
|
+
(glob) => globExtensions(glob).every((extension) => JS_EXTENSIONS.has(extension)),
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
// Extensions that carry no module-system commitment. An entry scoped only to
|
|
63
|
+
// .mjs/.mts or .cjs/.cts is configuring one module system specifically.
|
|
64
|
+
const GENERAL_SCRIPT_EXTENSIONS = new Set(['.js', '.jsx', '.ts', '.tsx']);
|
|
65
|
+
|
|
66
|
+
const targetsGeneralScripts = (entry) => entry.files.flat()
|
|
67
|
+
.some((glob) => globExtensions(glob).some((extension) => GENERAL_SCRIPT_EXTENSIONS.has(extension)));
|
|
33
68
|
|
|
34
69
|
// Widen an airbnb flat-config entry so its rules also cover .vue SFCs.
|
|
35
|
-
// Entries that intentionally target plain JS are left untouched
|
|
70
|
+
// Entries that intentionally target plain JS are left untouched, as are
|
|
71
|
+
// module-system-specific ones: airbnb scopes a CommonJS config to .cjs/.cts,
|
|
72
|
+
// and widening it onto SFCs applied commonjs globals and an ESM-hostile
|
|
73
|
+
// n/no-unsupported-features/es-syntax to files that are always modules.
|
|
36
74
|
const includeVue = (entry) => {
|
|
37
|
-
if (!Array.isArray(entry.files)
|
|
75
|
+
if (!Array.isArray(entry.files)
|
|
76
|
+
|| isJsOnly(entry)
|
|
77
|
+
|| !targetsGeneralScripts(entry)
|
|
78
|
+
|| entry.files.includes(VUE_GLOB)) {
|
|
38
79
|
return entry;
|
|
39
80
|
}
|
|
40
81
|
|
|
@@ -52,11 +93,23 @@ const ensureScriptScope = (entry) => (Array.isArray(entry.files) ? entry : { ...
|
|
|
52
93
|
// Give an unscoped entry a .vue scope, so vue rules never reach other files.
|
|
53
94
|
const ensureVueScope = (entry) => (Array.isArray(entry.files) ? entry : { ...entry, files: [VUE_GLOB] });
|
|
54
95
|
|
|
96
|
+
// Plugins expose their shared configs as flat-config objects, which this file
|
|
97
|
+
// spreads. A plugin that migrates one to an array would spread into
|
|
98
|
+
// { 0: ..., 1: ... } — an entry that registers nothing and reports nothing,
|
|
99
|
+
// with no error anywhere. Fail at config load instead.
|
|
100
|
+
const asConfigObject = (config, source) => {
|
|
101
|
+
if (config === null || typeof config !== 'object' || Array.isArray(config)) {
|
|
102
|
+
throw new TypeError(`${source} is no longer a flat-config object — eslint.config.mjs needs updating`);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return config;
|
|
106
|
+
};
|
|
107
|
+
|
|
55
108
|
// Extract the JavaScript from Eta exec tags (<% ... %>) while masking every
|
|
56
109
|
// other character with whitespace, so reported line/column numbers still
|
|
57
110
|
// point at the original .eta file. Interpolation (<%=), raw (<%~) and comment
|
|
58
111
|
// (<%#) tags are skipped — they hold expressions, not statements.
|
|
59
|
-
const
|
|
112
|
+
const ETA_TAG_SOURCE = '<%([\\s\\S]*?)%>';
|
|
60
113
|
|
|
61
114
|
// Code offset of an exec tag's inner JS, skipping a leading slurp char (_ or -).
|
|
62
115
|
const etaCodeStart = (match, inner) => match.index + 2 + (/^[_-]/.test(inner) ? 1 : 0);
|
|
@@ -68,9 +121,12 @@ const etaCodeEnd = (match, inner) => match.index + 2 + inner.length - (/[_-]$/.t
|
|
|
68
121
|
const maskChunk = (chunk) => chunk.replace(/[^\n]/g, ' ');
|
|
69
122
|
|
|
70
123
|
const extractEtaScript = (text) => {
|
|
124
|
+
// Built per call: a shared /g regex carries lastIndex between invocations,
|
|
125
|
+
// so an early exit here would silently corrupt the next file's extraction.
|
|
126
|
+
const tagPattern = new RegExp(ETA_TAG_SOURCE, 'g');
|
|
71
127
|
let out = '';
|
|
72
128
|
let cursor = 0;
|
|
73
|
-
let match =
|
|
129
|
+
let match = tagPattern.exec(text);
|
|
74
130
|
|
|
75
131
|
while (match !== null) {
|
|
76
132
|
const inner = match[1];
|
|
@@ -83,7 +139,7 @@ const extractEtaScript = (text) => {
|
|
|
83
139
|
+ text.slice(codeStart, codeEnd)
|
|
84
140
|
+ maskChunk(text.slice(codeEnd, tagEnd));
|
|
85
141
|
cursor = tagEnd;
|
|
86
|
-
match =
|
|
142
|
+
match = tagPattern.exec(text);
|
|
87
143
|
}
|
|
88
144
|
|
|
89
145
|
return out + maskChunk(text.slice(cursor));
|
|
@@ -91,7 +147,7 @@ const extractEtaScript = (text) => {
|
|
|
91
147
|
|
|
92
148
|
// Processor that lets ESLint lint the JS inside .eta templates.
|
|
93
149
|
const etaProcessor = {
|
|
94
|
-
meta: { name: 'blacklizard/eta', version:
|
|
150
|
+
meta: { name: 'blacklizard/eta', version: packageJson.version },
|
|
95
151
|
preprocess: (text) => [{ text: extractEtaScript(text), filename: 'script.js' }],
|
|
96
152
|
postprocess: (messageLists) => messageLists.flat(),
|
|
97
153
|
supportsAutofix: false,
|
|
@@ -101,7 +157,7 @@ const baseEntries = [
|
|
|
101
157
|
// ESLint recommended config
|
|
102
158
|
{
|
|
103
159
|
name: 'js/config',
|
|
104
|
-
...js.configs.recommended,
|
|
160
|
+
...asConfigObject(js.configs.recommended, '@eslint/js configs.recommended'),
|
|
105
161
|
},
|
|
106
162
|
// Stylistic plugin
|
|
107
163
|
plugins.stylistic,
|
|
@@ -157,11 +213,25 @@ const vueEntries = [
|
|
|
157
213
|
// Consumers must set settings['better-tailwindcss'].entryPoint (Tailwind v4)
|
|
158
214
|
// or .tailwindConfig (v3) so class-resolution rules work.
|
|
159
215
|
const tailwindEntry = (files) => ({
|
|
160
|
-
...betterTailwind.configs.recommended,
|
|
216
|
+
...asConfigObject(betterTailwind.configs.recommended, 'eslint-plugin-better-tailwindcss configs.recommended'),
|
|
161
217
|
name: 'blacklizard/tailwind',
|
|
162
218
|
files,
|
|
163
219
|
});
|
|
164
220
|
|
|
221
|
+
// airbnb-extended pins parserOptions.ecmaVersion to 2018, and espree honours
|
|
222
|
+
// that over languageOptions.ecmaVersion — so optional chaining, nullish
|
|
223
|
+
// coalescing, class fields, top-level await and import.meta are all fatal
|
|
224
|
+
// parse errors without this. sourceType is deliberately left alone so .cjs
|
|
225
|
+
// files keep being parsed as scripts.
|
|
226
|
+
const languageOverrides = {
|
|
227
|
+
name: 'blacklizard/language-options',
|
|
228
|
+
files: SCRIPT_FILES,
|
|
229
|
+
languageOptions: {
|
|
230
|
+
ecmaVersion: 'latest',
|
|
231
|
+
parserOptions: { ecmaVersion: 'latest' },
|
|
232
|
+
},
|
|
233
|
+
};
|
|
234
|
+
|
|
165
235
|
const stylisticOverrides = {
|
|
166
236
|
name: 'blacklizard/stylistic-overrides',
|
|
167
237
|
files: SCRIPT_FILES,
|
|
@@ -174,14 +244,20 @@ const stylisticOverrides = {
|
|
|
174
244
|
},
|
|
175
245
|
};
|
|
176
246
|
|
|
247
|
+
// House style applied in every scope this config lints, including the eta
|
|
248
|
+
// entry — which cannot inherit it from the airbnb configs it does not include.
|
|
249
|
+
const SHARED_STYLE_RULES = {
|
|
250
|
+
'no-console': ['error', { allow: ['warn', 'error'] }],
|
|
251
|
+
'@stylistic/semi': ['error', 'always'],
|
|
252
|
+
};
|
|
253
|
+
|
|
177
254
|
const blacklizardOverrides = {
|
|
178
255
|
name: 'blacklizard/overrides',
|
|
179
256
|
files: SCRIPT_FILES,
|
|
180
257
|
rules: {
|
|
258
|
+
...SHARED_STYLE_RULES,
|
|
181
259
|
curly: ['error', 'all'],
|
|
182
|
-
'no-console': ['error', { allow: ['warn', 'error'] }],
|
|
183
260
|
'max-depth': ['error', 2],
|
|
184
|
-
'@stylistic/semi': ['error', 'always'],
|
|
185
261
|
'@stylistic/padding-line-between-statements': [
|
|
186
262
|
'error',
|
|
187
263
|
// Blank line after the import block
|
|
@@ -219,7 +295,7 @@ const ignores = {
|
|
|
219
295
|
|
|
220
296
|
// CSS linting via @eslint/css.
|
|
221
297
|
const cssEntry = {
|
|
222
|
-
...cssPlugin.configs.recommended,
|
|
298
|
+
...asConfigObject(cssPlugin.configs.recommended, '@eslint/css configs.recommended'),
|
|
223
299
|
name: 'blacklizard/css',
|
|
224
300
|
files: ['**/*.css'],
|
|
225
301
|
language: 'css/css',
|
|
@@ -234,12 +310,44 @@ const cssEntry = {
|
|
|
234
310
|
|
|
235
311
|
// HTML markup linting via @html-eslint.
|
|
236
312
|
const htmlEntry = {
|
|
237
|
-
...htmlPlugin.configs['flat/recommended'],
|
|
313
|
+
...asConfigObject(htmlPlugin.configs['flat/recommended'], "@html-eslint configs['flat/recommended']"),
|
|
238
314
|
name: 'blacklizard/html',
|
|
239
315
|
files: ['**/*.html'],
|
|
240
316
|
language: '@html-eslint/html',
|
|
241
317
|
};
|
|
242
318
|
|
|
319
|
+
// airbnb allows devDependencies in tool config and test files through the
|
|
320
|
+
// rule's own devDependencies globs, which import-x matches with minimatch and
|
|
321
|
+
// no `dot` option. `**` never crosses a dot-segment, so a config file under
|
|
322
|
+
// .config/ or .claude/worktrees/ — or in any project whose absolute path has
|
|
323
|
+
// one, when ESLint runs from outside it — was reported for importing the very
|
|
324
|
+
// packages it exists to configure. Re-apply airbnb's glob list through ESLint's
|
|
325
|
+
// own file matcher, which is dot-safe and resolved against the config file.
|
|
326
|
+
const EXTRANEOUS_DEPS_RULE = 'import-x/no-extraneous-dependencies';
|
|
327
|
+
|
|
328
|
+
const airbnbExtraneousDeps = [...baseEntries, ...typescriptEntries]
|
|
329
|
+
.map((entry) => entry.rules?.[EXTRANEOUS_DEPS_RULE])
|
|
330
|
+
.filter(Boolean);
|
|
331
|
+
|
|
332
|
+
if (airbnbExtraneousDeps.length === 0
|
|
333
|
+
|| !airbnbExtraneousDeps.every(([, options]) => Array.isArray(options?.devDependencies))) {
|
|
334
|
+
throw new TypeError(`airbnb-extended no longer sets ${EXTRANEOUS_DEPS_RULE} devDependencies globs — eslint.config.mjs needs updating`);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
const [extraneousDepsSeverity, extraneousDepsOptions] = airbnbExtraneousDeps.at(-1);
|
|
338
|
+
const DEV_DEPENDENCY_GLOBS = [...new Set(airbnbExtraneousDeps.flatMap(([, options]) => options.devDependencies))];
|
|
339
|
+
const SCRIPT_GLOB = '**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx,vue}';
|
|
340
|
+
|
|
341
|
+
const devDependencyFilesEntry = {
|
|
342
|
+
name: 'blacklizard/dev-dependency-files',
|
|
343
|
+
// Each glob is paired with SCRIPT_GLOB so a .css or .html file under test/
|
|
344
|
+
// never receives an import-x rule its plugin is not registered for.
|
|
345
|
+
files: DEV_DEPENDENCY_GLOBS.map((glob) => [glob, SCRIPT_GLOB]),
|
|
346
|
+
rules: {
|
|
347
|
+
[EXTRANEOUS_DEPS_RULE]: [extraneousDepsSeverity, { ...extraneousDepsOptions, devDependencies: true }],
|
|
348
|
+
},
|
|
349
|
+
};
|
|
350
|
+
|
|
243
351
|
// Relaxed rules for test files.
|
|
244
352
|
const testOverrides = {
|
|
245
353
|
name: 'blacklizard/test-overrides',
|
|
@@ -267,8 +375,10 @@ export const typescriptConfig = defineConfig([
|
|
|
267
375
|
...typescriptEntries.map(scopeTs(TS_FILES)),
|
|
268
376
|
// Tailwind class linting for JSX/TSX
|
|
269
377
|
tailwindEntry(['**/*.jsx', '**/*.tsx']),
|
|
378
|
+
languageOverrides,
|
|
270
379
|
stylisticOverrides,
|
|
271
380
|
blacklizardOverrides,
|
|
381
|
+
devDependencyFilesEntry,
|
|
272
382
|
testOverrides,
|
|
273
383
|
]);
|
|
274
384
|
|
|
@@ -284,8 +394,10 @@ export const vueConfig = defineConfig([
|
|
|
284
394
|
...vueEntries,
|
|
285
395
|
// Tailwind class linting for .vue SFCs and JSX/TSX
|
|
286
396
|
tailwindEntry([VUE_GLOB, '**/*.jsx', '**/*.tsx']),
|
|
397
|
+
languageOverrides,
|
|
287
398
|
stylisticOverrides,
|
|
288
399
|
blacklizardOverrides,
|
|
400
|
+
devDependencyFilesEntry,
|
|
289
401
|
testOverrides,
|
|
290
402
|
]);
|
|
291
403
|
|
|
@@ -316,7 +428,7 @@ const etaProcessorEntry = {
|
|
|
316
428
|
const etaRulesEntry = {
|
|
317
429
|
name: 'blacklizard/eta',
|
|
318
430
|
files: ['**/*.eta/*.js'],
|
|
319
|
-
plugins: { '@stylistic':
|
|
431
|
+
plugins: { '@stylistic': stylistic },
|
|
320
432
|
languageOptions: {
|
|
321
433
|
ecmaVersion: 'latest',
|
|
322
434
|
sourceType: 'script',
|
|
@@ -336,12 +448,12 @@ const etaRulesEntry = {
|
|
|
336
448
|
'@stylistic/max-len': 'off',
|
|
337
449
|
'@stylistic/padding-line-between-statements': 'off',
|
|
338
450
|
'@stylistic/lines-around-comment': 'off',
|
|
339
|
-
// Style —
|
|
451
|
+
// Style — the airbnb configs are not part of etaConfig, so the rules they
|
|
452
|
+
// would otherwise supply are restated here.
|
|
453
|
+
...SHARED_STYLE_RULES,
|
|
340
454
|
eqeqeq: ['error', 'always'],
|
|
341
455
|
'no-var': 'error',
|
|
342
456
|
'prefer-const': 'error',
|
|
343
|
-
'no-console': ['error', { allow: ['warn', 'error'] }],
|
|
344
|
-
'@stylistic/semi': ['error', 'always'],
|
|
345
457
|
'@stylistic/quotes': ['error', 'single', { avoidEscape: true }],
|
|
346
458
|
'@stylistic/comma-dangle': ['error', 'always-multiline'],
|
|
347
459
|
},
|
|
@@ -374,9 +486,25 @@ export const autoConfig = defineConfig([
|
|
|
374
486
|
cssEntry,
|
|
375
487
|
etaProcessorEntry,
|
|
376
488
|
etaRulesEntry,
|
|
489
|
+
languageOverrides,
|
|
377
490
|
stylisticOverrides,
|
|
378
491
|
blacklizardOverrides,
|
|
492
|
+
devDependencyFilesEntry,
|
|
379
493
|
testOverrides,
|
|
380
494
|
]);
|
|
381
495
|
|
|
382
|
-
|
|
496
|
+
// Bound under its own name, the default export put consumers in a bind:
|
|
497
|
+
// `import config` warned import-x/no-rename-default (the default is named
|
|
498
|
+
// autoConfig) and `import autoConfig` errored import-x/no-named-as-default
|
|
499
|
+
// (that is also a named export). Naming the binding `config` makes the
|
|
500
|
+
// documented `import config from '@blacklizard/eslint-blacklizard'` lint clean
|
|
501
|
+
// while the default stays the very same array as autoConfig.
|
|
502
|
+
const config = autoConfig;
|
|
503
|
+
|
|
504
|
+
export default config;
|
|
505
|
+
|
|
506
|
+
// Not part of the supported surface — exported only so the scope-rewriting
|
|
507
|
+
// helpers can be tested directly. They guard against upstream shapes that
|
|
508
|
+
// eslint-config-airbnb-extended does not currently emit, so nothing else
|
|
509
|
+
// exercises them.
|
|
510
|
+
export const internals = { globExtensions, isJsOnly };
|
package/package.json
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blacklizard/eslint-blacklizard",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Reusable, opinionated ESLint config — blacklizard code standards.",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/blacklizard/eslint.git"
|
|
9
|
+
},
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/blacklizard/eslint/issues"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://github.com/blacklizard/eslint#readme",
|
|
6
14
|
"main": "eslint.config.mjs",
|
|
7
15
|
"exports": {
|
|
8
16
|
".": "./eslint.config.mjs"
|
|
@@ -12,7 +20,7 @@
|
|
|
12
20
|
"CHANGELOG.md"
|
|
13
21
|
],
|
|
14
22
|
"scripts": {
|
|
15
|
-
"lint": "eslint .",
|
|
23
|
+
"lint": "eslint . --ignore-pattern \"test/fixtures/**\"",
|
|
16
24
|
"test": "node --test",
|
|
17
25
|
"changeset": "changeset",
|
|
18
26
|
"version": "changeset version",
|
|
@@ -33,7 +41,17 @@
|
|
|
33
41
|
"access": "public"
|
|
34
42
|
},
|
|
35
43
|
"peerDependencies": {
|
|
36
|
-
"eslint": ">=
|
|
44
|
+
"eslint": ">=10",
|
|
45
|
+
"tailwindcss": "^3.3.0 || ^4.1.17",
|
|
46
|
+
"typescript": ">=4.8.4 <6.1.0"
|
|
47
|
+
},
|
|
48
|
+
"peerDependenciesMeta": {
|
|
49
|
+
"tailwindcss": {
|
|
50
|
+
"optional": true
|
|
51
|
+
},
|
|
52
|
+
"typescript": {
|
|
53
|
+
"optional": true
|
|
54
|
+
}
|
|
37
55
|
},
|
|
38
56
|
"engines": {
|
|
39
57
|
"node": ">=24",
|
|
@@ -42,19 +60,20 @@
|
|
|
42
60
|
"packageManager": "pnpm@10.33.0",
|
|
43
61
|
"dependencies": {
|
|
44
62
|
"@eslint/compat": "^2.1.0",
|
|
45
|
-
"@eslint/css": "^1.
|
|
46
|
-
"@eslint/js": "^
|
|
47
|
-
"@html-eslint/eslint-plugin": "^0.
|
|
48
|
-
"@html-eslint/parser": "^0.
|
|
49
|
-
"@
|
|
50
|
-
"eslint
|
|
51
|
-
"eslint-
|
|
52
|
-
"eslint-plugin-
|
|
53
|
-
"
|
|
63
|
+
"@eslint/css": "^1.4.0",
|
|
64
|
+
"@eslint/js": "^10.0.1",
|
|
65
|
+
"@html-eslint/eslint-plugin": "^0.64.0",
|
|
66
|
+
"@html-eslint/parser": "^0.64.0",
|
|
67
|
+
"@stylistic/eslint-plugin": "^5.10.0",
|
|
68
|
+
"@typescript-eslint/parser": "^8.65.0",
|
|
69
|
+
"eslint-config-airbnb-extended": "^3.1.1",
|
|
70
|
+
"eslint-plugin-better-tailwindcss": "^4.7.0",
|
|
71
|
+
"eslint-plugin-vue": "^10.10.0",
|
|
72
|
+
"vue-eslint-parser": "^10.4.1"
|
|
54
73
|
},
|
|
55
74
|
"devDependencies": {
|
|
56
|
-
"@changesets/cli": "^2.31.
|
|
57
|
-
"eslint": "^
|
|
58
|
-
"tailwindcss": "^4.3.
|
|
75
|
+
"@changesets/cli": "^2.31.1",
|
|
76
|
+
"eslint": "^10.7.0",
|
|
77
|
+
"tailwindcss": "^4.3.3"
|
|
59
78
|
}
|
|
60
79
|
}
|