@lusc/eslint-config 2.0.5 → 3.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.
@@ -0,0 +1,3 @@
1
+ import comments from '@eslint-community/eslint-plugin-eslint-comments/configs';
2
+
3
+ export default [comments.recommended];
@@ -0,0 +1,27 @@
1
+ import js from '@eslint/js';
2
+
3
+ export default [
4
+ js.configs.recommended,
5
+ {
6
+ rules: {
7
+ 'no-unused-vars': [
8
+ 'error',
9
+ {
10
+ vars: 'all',
11
+ varsIgnorePattern: /^_/.source,
12
+ args: 'after-used',
13
+ ignoreRestSiblings: true,
14
+ argsIgnorePattern: /^_/.source,
15
+ caughtErrors: 'all',
16
+ caughtErrorsIgnorePattern: /^_$/.source,
17
+ },
18
+ ],
19
+ 'no-empty': [
20
+ 'error',
21
+ {
22
+ allowEmptyCatch: true,
23
+ },
24
+ ],
25
+ },
26
+ },
27
+ ];
@@ -0,0 +1,30 @@
1
+ import eslintPluginImportX from 'eslint-plugin-import-x';
2
+
3
+ export default [
4
+ eslintPluginImportX.flatConfigs.recommended,
5
+ eslintPluginImportX.flatConfigs.typescript,
6
+ {
7
+ rules: {
8
+ 'import-x/no-useless-path-segments': 'error',
9
+ 'import-x/no-commonjs': 'error',
10
+ 'import-x/first': 'error',
11
+ 'import-x/newline-after-import': 'error',
12
+ 'import-x/order': [
13
+ 'error',
14
+ {
15
+ groups: ['builtin', 'external', 'parent', 'sibling', 'index'],
16
+ 'newlines-between': 'always',
17
+ alphabetize: {
18
+ order: 'asc',
19
+ caseInsensitive: true,
20
+ },
21
+ },
22
+ ],
23
+ 'import-x/no-named-as-default-member': 'off',
24
+ 'import-x/no-named-as-default': 'off',
25
+ /* Typescript does these better */
26
+ 'import-x/no-unresolved': 'off',
27
+ 'import-x/default': 'off',
28
+ },
29
+ },
30
+ ];
package/configs/n.js ADDED
@@ -0,0 +1,13 @@
1
+ import nodePlugin from 'eslint-plugin-n';
2
+
3
+ export default [
4
+ nodePlugin.configs['flat/recommended'],
5
+ {
6
+ rules: {
7
+ 'n/no-missing-import': 'off',
8
+ 'n/prefer-global/buffer': ['error', 'never'],
9
+ 'n/prefer-global/process': ['error', 'never'],
10
+ 'n/prefer-node-protocol': 'error',
11
+ },
12
+ },
13
+ ];
@@ -0,0 +1,11 @@
1
+ import pluginPromise from 'eslint-plugin-promise';
2
+
3
+ export default [
4
+ pluginPromise.configs['flat/recommended'],
5
+ {
6
+ rules: {
7
+ 'promise/prefer-await-to-then': 'error',
8
+ 'promise/always-return': 'off',
9
+ },
10
+ },
11
+ ];
@@ -0,0 +1,3 @@
1
+ import * as regexpPlugin from 'eslint-plugin-regexp';
2
+
3
+ export default [regexpPlugin.configs['flat/recommended']];
@@ -0,0 +1,46 @@
1
+ import tsEslint from 'typescript-eslint';
2
+
3
+ export default [
4
+ ...tsEslint.configs.strictTypeChecked,
5
+ {
6
+ languageOptions: {
7
+ parserOptions: {
8
+ projectService: true,
9
+ tsconfigRootDir: import.meta.dirname,
10
+ },
11
+ },
12
+ rules: {
13
+ '@typescript-eslint/restrict-template-expressions': [
14
+ 'error',
15
+ {
16
+ allowNumber: true,
17
+ },
18
+ ],
19
+ '@typescript-eslint/unbound-method': 'off',
20
+ '@typescript-eslint/no-non-null-assertion': 'off',
21
+ '@typescript-eslint/no-unused-vars': [
22
+ 'error',
23
+ {
24
+ vars: 'all',
25
+ varsIgnorePattern: /^_/.source,
26
+ args: 'after-used',
27
+ ignoreRestSiblings: true,
28
+ argsIgnorePattern: /^_/.source,
29
+ caughtErrors: 'all',
30
+ caughtErrorsIgnorePattern: /^_$/.source,
31
+ },
32
+ ],
33
+ '@typescript-eslint/no-misused-promises': [
34
+ 'error',
35
+ {
36
+ checksConditionals: true,
37
+ // Useful for event handlers
38
+ checksVoidReturn: false,
39
+ },
40
+ ],
41
+ },
42
+ },
43
+ ].map(config => ({
44
+ files: ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts'],
45
+ ...config,
46
+ }));
@@ -0,0 +1,12 @@
1
+ import eslintPluginUnicorn from 'eslint-plugin-unicorn';
2
+
3
+ export default [
4
+ eslintPluginUnicorn.configs['flat/recommended'],
5
+ {
6
+ rules: {
7
+ 'unicorn/no-null': 'off',
8
+ // Math.min and max don't support bigint, so ternary is necessary there
9
+ 'unicorn/prefer-math-min-max': 'off',
10
+ },
11
+ },
12
+ ];
package/index.js CHANGED
@@ -1,12 +1,14 @@
1
- import js from '@eslint/js';
2
- import comments from '@eslint-community/eslint-plugin-eslint-comments/configs';
3
1
  import * as tsParser from '@typescript-eslint/parser';
4
- import eslintPluginImportX from 'eslint-plugin-import-x';
5
- import nodePlugin from 'eslint-plugin-n';
6
- import pluginPromise from 'eslint-plugin-promise';
7
- import eslintPluginUnicorn from 'eslint-plugin-unicorn';
8
2
  import globals from 'globals';
9
- import {configs as tsConfigs} from 'typescript-eslint';
3
+
4
+ import comments from './configs/comments.js';
5
+ import eslint from './configs/eslint.js';
6
+ import importConfig from './configs/import.js';
7
+ import n from './configs/n.js';
8
+ import promise from './configs/promise.js';
9
+ import regexp from './configs/regexp.js';
10
+ import typescript from './configs/typescript.js';
11
+ import unicorn from './configs/unicorn.js';
10
12
 
11
13
  const ignores = ['**/dist/', '**/.svelte-kit/', '**/build/'];
12
14
 
@@ -25,106 +27,12 @@ export default [
25
27
  sourceType: 'module',
26
28
  },
27
29
  },
28
- js.configs.recommended,
29
- ...tsConfigs.strictTypeChecked.map(config => ({
30
- files: ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts'],
31
- ...config,
32
- })),
33
- comments.recommended,
34
- nodePlugin.configs['flat/recommended'],
35
- pluginPromise.configs['flat/recommended'],
36
- eslintPluginUnicorn.configs['flat/recommended'],
37
- eslintPluginImportX.flatConfigs.recommended,
38
- eslintPluginImportX.flatConfigs.typescript,
39
- {
40
- rules: {
41
- 'no-unused-vars': [
42
- 'error',
43
- {
44
- vars: 'all',
45
- varsIgnorePattern: /^_/.source,
46
- args: 'after-used',
47
- ignoreRestSiblings: true,
48
- argsIgnorePattern: /^_/.source,
49
- caughtErrors: 'all',
50
- caughtErrorsIgnorePattern: /^_$/.source,
51
- },
52
- ],
53
- 'promise/prefer-await-to-then': 'error',
54
- 'promise/always-return': 'off',
55
- 'unicorn/no-null': 'off',
56
- // Math.min and max don't support bigint, so ternary is necessary there
57
- 'unicorn/prefer-math-min-max': 'off',
58
- 'n/no-missing-import': 'off',
59
- // Too many false positives
60
- 'no-empty': [
61
- 'error',
62
- {
63
- allowEmptyCatch: true,
64
- },
65
- ],
66
- 'n/prefer-global/buffer': ['error', 'never'],
67
- 'n/prefer-global/process': ['error', 'never'],
68
- 'n/prefer-node-protocol': 'error',
69
- 'import-x/no-useless-path-segments': 'error',
70
- 'import-x/no-commonjs': 'error',
71
- 'import-x/first': 'error',
72
- 'import-x/newline-after-import': 'error',
73
- 'import-x/order': [
74
- 'error',
75
- {
76
- groups: ['builtin', 'external', 'parent', 'sibling', 'index'],
77
- 'newlines-between': 'always',
78
- alphabetize: {
79
- order: 'asc',
80
- caseInsensitive: true,
81
- },
82
- },
83
- ],
84
- 'import-x/no-named-as-default-member': 'off',
85
- /* Typescript does these better */
86
- 'import-x/no-unresolved': 'off',
87
- 'import-x/default': 'off',
88
- },
89
- },
90
- {
91
- files: ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts'],
92
- languageOptions: {
93
- parserOptions: {
94
- projectService: true,
95
- tsconfigRootDir: import.meta.dirname,
96
- },
97
- },
98
- rules: {
99
- '@typescript-eslint/restrict-template-expressions': [
100
- 'error',
101
- {
102
- allowNumber: true,
103
- },
104
- ],
105
- '@typescript-eslint/unbound-method': 'off',
106
- '@typescript-eslint/no-non-null-assertion': 'off',
107
- 'no-unused-vars': 'off',
108
- '@typescript-eslint/no-unused-vars': [
109
- 'error',
110
- {
111
- vars: 'all',
112
- varsIgnorePattern: /^_/.source,
113
- args: 'after-used',
114
- ignoreRestSiblings: true,
115
- argsIgnorePattern: /^_/.source,
116
- caughtErrors: 'all',
117
- caughtErrorsIgnorePattern: /^_$/.source,
118
- },
119
- ],
120
- '@typescript-eslint/no-misused-promises': [
121
- 'error',
122
- {
123
- checksConditionals: true,
124
- // Useful for event handlers
125
- checksVoidReturn: false,
126
- },
127
- ],
128
- },
129
- },
130
- ];
30
+ eslint,
31
+ comments,
32
+ promise,
33
+ unicorn,
34
+ n,
35
+ importConfig,
36
+ regexp,
37
+ typescript,
38
+ ].flat();
package/package.json CHANGED
@@ -6,15 +6,16 @@
6
6
  "dependencies": {
7
7
  "@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
8
8
  "@eslint/js": "^9.14.0",
9
- "@typescript-eslint/parser": "^8.13.0",
9
+ "@typescript-eslint/parser": "^8.14.0",
10
10
  "eslint-import-resolver-typescript": "^3.6.3",
11
- "eslint-plugin-import-x": "^4.4.0",
11
+ "eslint-plugin-import-x": "^4.4.2",
12
12
  "eslint-plugin-n": "^17.13.1",
13
13
  "eslint-plugin-promise": "^7.1.0",
14
+ "eslint-plugin-regexp": "^2.6.0",
14
15
  "eslint-plugin-unicorn": "^56.0.0",
15
16
  "globals": "^15.12.0",
16
17
  "typescript": "^5.6.3",
17
- "typescript-eslint": "^8.13.0"
18
+ "typescript-eslint": "^8.14.0"
18
19
  },
19
20
  "devDependencies": {
20
21
  "@types/eslint": "^9.6.1",
@@ -26,7 +27,8 @@
26
27
  },
27
28
  "files": [
28
29
  "*.js",
29
- "*.d.ts"
30
+ "*.d.ts",
31
+ "configs/*.js"
30
32
  ],
31
33
  "license": "MIT",
32
34
  "name": "@lusc/eslint-config",
@@ -41,6 +43,6 @@
41
43
  "fmt": "prettier -w .",
42
44
  "lint": "eslint --fix"
43
45
  },
44
- "version": "2.0.5",
46
+ "version": "3.0.0",
45
47
  "type": "module"
46
48
  }