@enke.dev/lint 0.8.3 → 0.9.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/README.md +7 -1
- package/eslint-plugins.d.ts +24 -0
- package/eslint.config.d.ts +1 -2
- package/eslint.config.js +113 -80
- package/package.json +17 -21
package/README.md
CHANGED
|
@@ -66,7 +66,11 @@ Like the experimental typescript config flag above, the VSCode Eslint plugin can
|
|
|
66
66
|
|
|
67
67
|
Using a shared Stylelint config with two major presets, `stylelint-config-standard-scss` and `stylelint-config-rational-order`.
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
As this is totally opt-in, all required dependencies must be installed:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
npm i -D stylelint stylelint-config-rational-order stylelint-config-standard-scss stylelint-order
|
|
73
|
+
```
|
|
70
74
|
|
|
71
75
|
Create a `stylelint.config.js` file in the root of your project and add the following content:
|
|
72
76
|
|
|
@@ -77,3 +81,5 @@ import { defineConfig } from '@enke.dev/lint/stylelint.config.js';
|
|
|
77
81
|
|
|
78
82
|
export default defineConfig({ cssCustomPropertyPrefix: 'your-prefix' });
|
|
79
83
|
```
|
|
84
|
+
|
|
85
|
+
For now, no TypeScript support is included.
|
package/eslint-plugins.d.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
declare module 'eslint-plugin-html' {
|
|
2
|
+
import type { ESLint } from 'eslint';
|
|
3
|
+
|
|
4
|
+
const plugin: ESLint.Plugin;
|
|
5
|
+
|
|
6
|
+
export default plugin;
|
|
7
|
+
}
|
|
8
|
+
|
|
1
9
|
declare module 'eslint-plugin-import-extensions' {
|
|
2
10
|
import type { ESLint } from 'eslint';
|
|
3
11
|
|
|
@@ -17,3 +25,19 @@ declare module 'eslint-plugin-import' {
|
|
|
17
25
|
|
|
18
26
|
export default js;
|
|
19
27
|
}
|
|
28
|
+
|
|
29
|
+
declare module 'eslint-plugin-lit-a11y' {
|
|
30
|
+
import type { ESLint, Linter } from 'eslint';
|
|
31
|
+
|
|
32
|
+
export const configs: {
|
|
33
|
+
readonly recommended: {
|
|
34
|
+
readonly rules: Readonly<Linter.RulesRecord>;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const plugin: ESLint.Plugin & {
|
|
39
|
+
readonly configs;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export default plugin;
|
|
43
|
+
}
|
package/eslint.config.d.ts
CHANGED
package/eslint.config.js
CHANGED
|
@@ -2,97 +2,130 @@
|
|
|
2
2
|
import { fixupPluginRules } from '@eslint/compat';
|
|
3
3
|
import eslintJs from '@eslint/js';
|
|
4
4
|
import eslintJson from '@eslint/json';
|
|
5
|
+
import { defineConfig } from 'eslint/config';
|
|
6
|
+
import eslintPluginHtml from 'eslint-plugin-html';
|
|
5
7
|
import eslintPluginImport from 'eslint-plugin-import';
|
|
6
8
|
import eslintPluginImportExtension from 'eslint-plugin-import-extensions';
|
|
7
9
|
import { configs as eslintPluginLitConfigs } from 'eslint-plugin-lit';
|
|
8
|
-
import
|
|
10
|
+
import { configs as eslintPluginLitA11yConfigs } from 'eslint-plugin-lit-a11y';
|
|
11
|
+
import { configs as eslintPluginPackageJsonConfigs } from 'eslint-plugin-package-json';
|
|
9
12
|
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
|
|
10
13
|
import eslintPluginSimpleImportSort from 'eslint-plugin-simple-import-sort';
|
|
11
14
|
import eslintPluginUnusedImports from 'eslint-plugin-unused-imports';
|
|
12
15
|
import { configs as eslintPluginWebComponentsConfigs } from 'eslint-plugin-wc';
|
|
13
16
|
import eslintTs from 'typescript-eslint';
|
|
14
|
-
export default
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
export default defineConfig([
|
|
18
|
+
eslintJs.configs.recommended,
|
|
19
|
+
...eslintTs.configs.strict,
|
|
20
|
+
...eslintTs.configs.stylistic,
|
|
21
|
+
eslintPluginPrettierRecommended,
|
|
22
|
+
eslintPluginImport.flatConfigs.recommended,
|
|
23
|
+
{
|
|
24
|
+
ignores: ['node_modules/', 'dist/'],
|
|
21
25
|
},
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
// Javascript and Typescript files
|
|
27
|
+
{
|
|
28
|
+
files: ['**/*.{js,ts}'],
|
|
29
|
+
...eslintPluginWebComponentsConfigs['flat/recommended'],
|
|
30
|
+
...eslintPluginLitConfigs['flat/recommended'],
|
|
31
|
+
...eslintPluginLitA11yConfigs.recommended,
|
|
32
|
+
plugins: {
|
|
33
|
+
'simple-import-sort': eslintPluginSimpleImportSort,
|
|
34
|
+
'unused-imports': eslintPluginUnusedImports,
|
|
35
|
+
'import-extensions': fixupPluginRules(eslintPluginImportExtension),
|
|
27
36
|
},
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
37
|
+
languageOptions: {
|
|
38
|
+
parserOptions: {
|
|
39
|
+
ecmaVersion: 'latest',
|
|
40
|
+
project: true,
|
|
41
|
+
requireConfigFile: false,
|
|
42
|
+
sourceType: 'module',
|
|
43
|
+
tsconfigRootDir: import.meta.dirname,
|
|
44
|
+
},
|
|
33
45
|
},
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
'linebreak-style': ['error', 'unix'],
|
|
39
|
-
quotes: ['error', 'single', { avoidEscape: true }],
|
|
40
|
-
semi: ['error', 'always'],
|
|
41
|
-
// import sorting
|
|
42
|
-
'simple-import-sort/imports': [
|
|
43
|
-
'error',
|
|
44
|
-
{
|
|
45
|
-
groups: [
|
|
46
|
-
// Side effect imports.
|
|
47
|
-
['^\\u0000'],
|
|
48
|
-
// Node.js builtins prefixed with `node:`.
|
|
49
|
-
['^node:'],
|
|
50
|
-
// Packages.
|
|
51
|
-
// Things that start with a letter (or digit or underscore), or `@` followed by a letter.
|
|
52
|
-
['^@?\\w'],
|
|
53
|
-
// Absolute imports and other imports such as Vue-style `@/foo`.
|
|
54
|
-
// Anything not matched in another group.
|
|
55
|
-
['^'],
|
|
56
|
-
// Relative imports.
|
|
57
|
-
// Anything that starts with a dot.
|
|
58
|
-
['^\\.'],
|
|
59
|
-
// Assetic imports, most likely inline loaded style files for lit components
|
|
60
|
-
// or raw loaded files like images, meta data or fonts.
|
|
61
|
-
['\\?(inline|raw)$'],
|
|
62
|
-
],
|
|
46
|
+
settings: {
|
|
47
|
+
'import/resolver': {
|
|
48
|
+
typescript: true,
|
|
49
|
+
node: true,
|
|
63
50
|
},
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
51
|
+
litHtmlSources: true,
|
|
52
|
+
},
|
|
53
|
+
rules: {
|
|
54
|
+
// formatting
|
|
55
|
+
'@typescript-eslint/no-unused-expressions': [
|
|
56
|
+
'error',
|
|
57
|
+
{ allowShortCircuit: true, allowTernary: true },
|
|
58
|
+
],
|
|
59
|
+
curly: 'error',
|
|
60
|
+
'linebreak-style': ['error', 'unix'],
|
|
61
|
+
quotes: ['error', 'single', { avoidEscape: true }],
|
|
62
|
+
semi: ['error', 'always'],
|
|
63
|
+
// import sorting
|
|
64
|
+
'simple-import-sort/imports': [
|
|
65
|
+
'error',
|
|
66
|
+
{
|
|
67
|
+
groups: [
|
|
68
|
+
// Side effect imports.
|
|
69
|
+
['^\\u0000'],
|
|
70
|
+
// Node.js builtins prefixed with `node:`.
|
|
71
|
+
['^node:'],
|
|
72
|
+
// Packages.
|
|
73
|
+
// Things that start with a letter (or digit or underscore), or `@` followed by a letter.
|
|
74
|
+
['^@?\\w'],
|
|
75
|
+
// Absolute imports and other imports such as Vue-style `@/foo`.
|
|
76
|
+
// Anything not matched in another group.
|
|
77
|
+
['^'],
|
|
78
|
+
// Relative imports.
|
|
79
|
+
// Anything that starts with a dot.
|
|
80
|
+
['^\\.'],
|
|
81
|
+
// Assetic imports, most likely inline loaded style files for lit components
|
|
82
|
+
// or raw loaded files like images, meta data or fonts.
|
|
83
|
+
['\\?(inline|raw)$'],
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
'simple-import-sort/exports': 'error',
|
|
88
|
+
// import extensions
|
|
89
|
+
'import-extensions/require-extensions': ['error', { expectedExtensions: ['js'] }],
|
|
90
|
+
'import-extensions/require-index': ['error', { expectedExtensions: ['js'] }],
|
|
91
|
+
// import rules
|
|
92
|
+
'import/enforce-node-protocol-usage': ['error', 'always'], // enforce node: import prefix
|
|
93
|
+
'import/consistent-type-specifier-style': ['error', 'prefer-top-level'], // type imports
|
|
94
|
+
'import/first': 'error',
|
|
95
|
+
'import/newline-after-import': 'error',
|
|
96
|
+
'import/no-duplicates': 'error',
|
|
97
|
+
'import/no-unresolved': 'error',
|
|
98
|
+
'import/extensions': ['error', 'ignorePackages', { ts: 'never', js: 'always' }],
|
|
99
|
+
'prettier/prettier': ['error', {}, { usePrettierrc: true }],
|
|
100
|
+
// unused imports
|
|
101
|
+
'@typescript-eslint/no-unused-vars': 'off',
|
|
102
|
+
'unused-imports/no-unused-vars': [
|
|
103
|
+
'error',
|
|
104
|
+
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_', caughtErrors: 'none' },
|
|
105
|
+
],
|
|
106
|
+
'unused-imports/no-unused-imports': 'error',
|
|
107
|
+
// web components / a11y
|
|
108
|
+
'wc/guard-super-call': 'off',
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
// HTML files
|
|
112
|
+
{
|
|
113
|
+
files: ['**/*.html'],
|
|
114
|
+
plugins: { html: eslintPluginHtml },
|
|
85
115
|
},
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
116
|
+
// JSON files
|
|
117
|
+
{
|
|
118
|
+
...eslintPluginPackageJsonConfigs.recommended,
|
|
119
|
+
...eslintJson.configs.recommended,
|
|
120
|
+
ignores: ['package-lock.json'],
|
|
121
|
+
language: 'json/json',
|
|
122
|
+
rules: {
|
|
123
|
+
'no-irregular-whitespace': 'off',
|
|
124
|
+
'import-extensions/require-extensions': 'off',
|
|
125
|
+
'import-extensions/require-index': 'off',
|
|
126
|
+
},
|
|
127
|
+
settings: {
|
|
128
|
+
'html/html-extensions': ['.html'],
|
|
129
|
+
},
|
|
97
130
|
},
|
|
98
|
-
|
|
131
|
+
]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enke.dev/lint",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Meta package to provide linting for web projects",
|
|
5
5
|
"homepage": "https://github.com/enke-dev/lint",
|
|
6
6
|
"repository": {
|
|
@@ -20,6 +20,8 @@
|
|
|
20
20
|
"types": "eslint.config.d.ts",
|
|
21
21
|
"scripts": {
|
|
22
22
|
"lint": "eslint -c eslint.config.ts ./*.config.ts",
|
|
23
|
+
"inspect": "./node_modules/.bin/eslint-config-inspector --config eslint.config.ts",
|
|
24
|
+
"dev": "tsc --watch",
|
|
23
25
|
"build": "tsc"
|
|
24
26
|
},
|
|
25
27
|
"author": {
|
|
@@ -31,45 +33,39 @@
|
|
|
31
33
|
"access": "public"
|
|
32
34
|
},
|
|
33
35
|
"peerDependencies": {
|
|
34
|
-
"eslint": "^9.
|
|
36
|
+
"eslint": "^9.35.0",
|
|
35
37
|
"prettier": "^3.6.2"
|
|
36
38
|
},
|
|
37
39
|
"optionalDependencies": {
|
|
38
|
-
"stylelint": "^16.
|
|
40
|
+
"stylelint": "^16.24.0",
|
|
39
41
|
"stylelint-config-rational-order": "^0.1.2",
|
|
40
|
-
"stylelint-config-standard-scss": "^
|
|
42
|
+
"stylelint-config-standard-scss": "^16.0.0",
|
|
41
43
|
"stylelint-order": "^7.0.0"
|
|
42
44
|
},
|
|
43
45
|
"dependencies": {
|
|
44
46
|
"@eslint/compat": "^1.3.2",
|
|
45
|
-
"@eslint/js": "^9.34.0",
|
|
46
47
|
"@eslint/json": "^0.13.2",
|
|
47
|
-
"@typescript-eslint/eslint-plugin": "^8.42.0",
|
|
48
|
-
"@typescript-eslint/parser": "^8.42.0",
|
|
49
48
|
"eslint-config-prettier": "^10.1.8",
|
|
50
49
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
50
|
+
"eslint-plugin-html": "^8.1.3",
|
|
51
51
|
"eslint-plugin-import": "^2.32.0",
|
|
52
52
|
"eslint-plugin-import-extensions": "^0.1.5",
|
|
53
53
|
"eslint-plugin-lit": "^2.1.1",
|
|
54
|
-
"eslint-plugin-
|
|
54
|
+
"eslint-plugin-lit-a11y": "^5.1.1",
|
|
55
|
+
"eslint-plugin-package-json": "^0.56.2",
|
|
55
56
|
"eslint-plugin-prettier": "^5.5.4",
|
|
56
57
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
57
58
|
"eslint-plugin-unused-imports": "^4.2.0",
|
|
58
|
-
"eslint-plugin-wc": "^3.0.1"
|
|
59
|
-
"typescript": "^5.9.2",
|
|
60
|
-
"typescript-eslint": "^8.42.0"
|
|
59
|
+
"eslint-plugin-wc": "^3.0.1"
|
|
61
60
|
},
|
|
62
61
|
"devDependencies": {
|
|
63
|
-
"@
|
|
62
|
+
"@eslint/config-inspector": "1.2.0",
|
|
63
|
+
"@eslint/js": "9.35.0",
|
|
64
|
+
"@types/node": "24.3.1",
|
|
65
|
+
"eslint": "9.35.0",
|
|
64
66
|
"jiti": "2.5.1",
|
|
65
|
-
"
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
"eslint-plugin-unused-imports": {
|
|
69
|
-
"@typescript-eslint/eslint-plugin": "$@typescript-eslint/eslint-plugin"
|
|
70
|
-
},
|
|
71
|
-
"typescript-eslint": {
|
|
72
|
-
"typescript": "$typescript"
|
|
73
|
-
}
|
|
67
|
+
"prettier": "3.6.2",
|
|
68
|
+
"typescript": "5.9.2",
|
|
69
|
+
"typescript-eslint": "8.43.0"
|
|
74
70
|
}
|
|
75
71
|
}
|