@lusc/eslint-config 3.1.1 → 3.2.1

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.
@@ -1,46 +1,51 @@
1
1
  import tsEslint from 'typescript-eslint';
2
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,
3
+ /**
4
+ * @param {readonly string[]} globs
5
+ */
6
+ export default function typescript(globs) {
7
+ return [
8
+ ...tsEslint.configs.strictTypeChecked,
9
+ {
10
+ languageOptions: {
11
+ parserOptions: {
12
+ projectService: true,
13
+ tsconfigRootDir: import.meta.dirname,
31
14
  },
32
- ],
33
- '@typescript-eslint/no-misused-promises': [
34
- 'error',
35
- {
36
- checksConditionals: true,
37
- // Useful for event handlers
38
- checksVoidReturn: false,
39
- },
40
- ],
15
+ },
16
+ rules: {
17
+ '@typescript-eslint/restrict-template-expressions': [
18
+ 'error',
19
+ {
20
+ allowNumber: true,
21
+ },
22
+ ],
23
+ '@typescript-eslint/unbound-method': 'off',
24
+ '@typescript-eslint/no-non-null-assertion': 'off',
25
+ '@typescript-eslint/no-unused-vars': [
26
+ 'error',
27
+ {
28
+ vars: 'all',
29
+ varsIgnorePattern: /^_/.source,
30
+ args: 'after-used',
31
+ ignoreRestSiblings: true,
32
+ argsIgnorePattern: /^_/.source,
33
+ caughtErrors: 'all',
34
+ caughtErrorsIgnorePattern: /^_$/.source,
35
+ },
36
+ ],
37
+ '@typescript-eslint/no-misused-promises': [
38
+ 'error',
39
+ {
40
+ checksConditionals: true,
41
+ // Useful for event handlers
42
+ checksVoidReturn: false,
43
+ },
44
+ ],
45
+ },
41
46
  },
42
- },
43
- ].map(config => ({
44
- files: ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts'],
45
- ...config,
46
- }));
47
+ ].map(config => ({
48
+ ...config,
49
+ files: ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts', ...globs],
50
+ }));
51
+ }
package/index.d.ts CHANGED
@@ -1,3 +1,9 @@
1
1
  import type {Linter} from 'eslint';
2
2
  declare const config: readonly Linter.Config[];
3
3
  export default config;
4
+
5
+ type Options = {
6
+ typescriptGlobs: readonly string[];
7
+ };
8
+
9
+ export function withOptions(options: Options): readonly Linter.Config[];
package/index.js CHANGED
@@ -12,27 +12,33 @@ import unicorn from './configs/unicorn.js';
12
12
 
13
13
  const ignores = ['**/dist/', '**/.svelte-kit/', '**/build/'];
14
14
 
15
- export default [
16
- {
17
- ignores,
18
- },
19
- {
20
- languageOptions: {
21
- globals: {
22
- ...globals.browser,
23
- ...globals.nodeBuiltin,
15
+ export function withOptions({typescriptGlobs}) {
16
+ return [
17
+ {
18
+ ignores,
19
+ },
20
+ {
21
+ languageOptions: {
22
+ globals: {
23
+ ...globals.browser,
24
+ ...globals.nodeBuiltin,
25
+ },
26
+ parser: tsParser,
27
+ ecmaVersion: 'latest',
28
+ sourceType: 'module',
24
29
  },
25
- parser: tsParser,
26
- ecmaVersion: 'latest',
27
- sourceType: 'module',
28
30
  },
29
- },
30
- eslint,
31
- comments,
32
- promise,
33
- unicorn,
34
- n,
35
- importConfig,
36
- regexp,
37
- typescript,
38
- ].flat();
31
+ eslint,
32
+ comments,
33
+ promise,
34
+ unicorn,
35
+ n,
36
+ importConfig,
37
+ regexp,
38
+ typescript(typescriptGlobs),
39
+ ].flat();
40
+ }
41
+
42
+ export default withOptions({
43
+ typescriptGlobs: [],
44
+ });
package/package.json CHANGED
@@ -5,24 +5,24 @@
5
5
  },
6
6
  "dependencies": {
7
7
  "@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
8
- "@eslint/js": "^9.15.0",
9
- "@typescript-eslint/parser": "^8.15.0",
8
+ "@eslint/js": "^9.16.0",
9
+ "@typescript-eslint/parser": "^8.17.0",
10
10
  "eslint-import-resolver-typescript": "^3.6.3",
11
- "eslint-plugin-import-x": "^4.4.2",
12
- "eslint-plugin-n": "^17.13.2",
13
- "eslint-plugin-promise": "^7.1.0",
11
+ "eslint-plugin-import-x": "^4.5.0",
12
+ "eslint-plugin-n": "^17.14.0",
13
+ "eslint-plugin-promise": "^7.2.1",
14
14
  "eslint-plugin-regexp": "^2.7.0",
15
15
  "eslint-plugin-unicorn": "^56.0.1",
16
- "globals": "^15.12.0",
17
- "typescript": "^5.6.3",
18
- "typescript-eslint": "^8.15.0"
16
+ "globals": "^15.13.0",
17
+ "typescript": "^5.7.2",
18
+ "typescript-eslint": "^8.17.0"
19
19
  },
20
20
  "peerDependencies": {
21
- "eslint": "^9"
21
+ "eslint": "^9.16.0"
22
22
  },
23
23
  "devDependencies": {
24
- "eslint": "^9.15.0",
25
- "prettier": "^3.3.3"
24
+ "eslint": "^9.16.0",
25
+ "prettier": "^3.4.1"
26
26
  },
27
27
  "exports": {
28
28
  ".": "./index.js"
@@ -34,7 +34,7 @@
34
34
  ],
35
35
  "license": "MIT",
36
36
  "name": "@lusc/eslint-config",
37
- "packageManager": "yarn@4.5.1",
37
+ "packageManager": "yarn@4.5.3",
38
38
  "publishConfig": {
39
39
  "access": "public"
40
40
  },
@@ -45,6 +45,6 @@
45
45
  "fmt": "prettier -w .",
46
46
  "lint": "eslint --fix"
47
47
  },
48
- "version": "3.1.1",
48
+ "version": "3.2.1",
49
49
  "type": "module"
50
50
  }