@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 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
- For now, no TypeScript support is included.
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.
@@ -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
+ }
@@ -1,3 +1,2 @@
1
- import type { Linter } from 'eslint';
2
- declare const _default: Linter.Config[];
1
+ declare const _default: import("eslint").Linter.Config<import("eslint").Linter.RulesRecord>[];
3
2
  export default _default;
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 eslintPluginPackageJson from 'eslint-plugin-package-json';
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 eslintTs.config(eslintJs.configs.recommended, ...eslintTs.configs.strict, ...eslintTs.configs.stylistic, eslintPluginPrettierRecommended, eslintPluginImport.flatConfigs.recommended, eslintPluginPackageJson.configs.recommended, eslintPluginLitConfigs['flat/recommended'], eslintPluginWebComponentsConfigs['flat/recommended'], {
15
- ignores: ['node_modules/', 'dist/'],
16
- }, {
17
- plugins: {
18
- 'simple-import-sort': eslintPluginSimpleImportSort,
19
- 'unused-imports': eslintPluginUnusedImports,
20
- 'import-extensions': fixupPluginRules(eslintPluginImportExtension),
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
- languageOptions: {
24
- parserOptions: {
25
- project: true,
26
- tsconfigRootDir: __dirname,
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
- settings: {
30
- 'import/resolver': {
31
- typescript: true,
32
- node: true,
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
- rules: {
37
- // formatting
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
- 'simple-import-sort/exports': 'error',
66
- // import extensions
67
- 'import-extensions/require-extensions': ['error', { expectedExtensions: ['js'] }],
68
- 'import-extensions/require-index': ['error', { expectedExtensions: ['js'] }],
69
- // import rules
70
- 'import/enforce-node-protocol-usage': ['error', 'always'], // enforce node: import prefix
71
- 'import/consistent-type-specifier-style': ['error', 'prefer-top-level'], // type imports
72
- 'import/first': 'error',
73
- 'import/newline-after-import': 'error',
74
- 'import/no-duplicates': 'error',
75
- 'import/no-unresolved': 'error',
76
- 'import/extensions': ['error', 'ignorePackages', { ts: 'never', js: 'always' }],
77
- 'prettier/prettier': ['error', {}, { usePrettierrc: true }],
78
- // unused imports
79
- '@typescript-eslint/no-unused-vars': 'off',
80
- 'unused-imports/no-unused-vars': [
81
- 'error',
82
- { argsIgnorePattern: '^_', varsIgnorePattern: '^_', caughtErrors: 'none' },
83
- ],
84
- 'unused-imports/no-unused-imports': 'error',
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
- // json files
88
- {
89
- ...eslintJson.configs.recommended,
90
- files: ['**/*.json'],
91
- ignores: ['package-lock.json'],
92
- language: 'json/json',
93
- rules: {
94
- 'no-irregular-whitespace': 'off',
95
- 'import-extensions/require-extensions': 'off',
96
- 'import-extensions/require-index': 'off',
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.8.3",
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.34.0",
36
+ "eslint": "^9.35.0",
35
37
  "prettier": "^3.6.2"
36
38
  },
37
39
  "optionalDependencies": {
38
- "stylelint": "^16.23.1",
40
+ "stylelint": "^16.24.0",
39
41
  "stylelint-config-rational-order": "^0.1.2",
40
- "stylelint-config-standard-scss": "^15.0.1",
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-package-json": "^0.56.1",
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
- "@types/node": "24.3.0",
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
- "typescript": "5.9.2"
66
- },
67
- "overrides": {
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
  }