@vortiquo/eslint-config 1.2.0 → 1.2.1-beta.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.
- package/base-typescript.js +25 -43
- package/base.js +16 -0
- package/package.json +3 -1
package/base-typescript.js
CHANGED
|
@@ -1,18 +1,37 @@
|
|
|
1
1
|
import tseslint from 'typescript-eslint';
|
|
2
2
|
import { base } from './base.js';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* TypeScript file patterns - type-aware rules only apply to these
|
|
6
|
+
*/
|
|
7
|
+
const TS_FILES = ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts'];
|
|
8
|
+
|
|
4
9
|
/**
|
|
5
10
|
* Base TypeScript ESLint configuration.
|
|
6
11
|
* Extends base config with TypeScript-specific rules.
|
|
7
12
|
*
|
|
13
|
+
* Type-aware rules are ONLY applied to TypeScript files (.ts, .tsx, .mts, .cts).
|
|
14
|
+
* JavaScript files (including config files like eslint.config.js) are not affected.
|
|
15
|
+
*
|
|
8
16
|
* @type {import("eslint").Linter.Config[]}
|
|
9
17
|
*/
|
|
10
18
|
export const baseTypescript = [
|
|
11
19
|
...base,
|
|
12
|
-
|
|
13
|
-
|
|
20
|
+
|
|
21
|
+
// Apply type-checked configs ONLY to TypeScript files
|
|
22
|
+
...tseslint.configs.strictTypeChecked.map((config) => ({
|
|
23
|
+
...config,
|
|
24
|
+
files: TS_FILES,
|
|
25
|
+
})),
|
|
26
|
+
...tseslint.configs.stylisticTypeChecked.map((config) => ({
|
|
27
|
+
...config,
|
|
28
|
+
files: TS_FILES,
|
|
29
|
+
})),
|
|
30
|
+
|
|
31
|
+
// TypeScript-specific settings and rules (only for TS files)
|
|
14
32
|
{
|
|
15
33
|
name: 'vortiquo/typescript',
|
|
34
|
+
files: TS_FILES,
|
|
16
35
|
languageOptions: {
|
|
17
36
|
parserOptions: {
|
|
18
37
|
projectService: true,
|
|
@@ -99,50 +118,13 @@ export const baseTypescript = [
|
|
|
99
118
|
],
|
|
100
119
|
},
|
|
101
120
|
},
|
|
102
|
-
|
|
121
|
+
|
|
122
|
+
// Allow relative imports in config files (only applies to TS files since
|
|
123
|
+
// no-restricted-imports is only defined in base-typescript)
|
|
103
124
|
{
|
|
104
125
|
name: 'vortiquo/typescript/config-files',
|
|
105
|
-
files: [
|
|
106
|
-
'**/*.config.{js,ts,mjs,cjs}',
|
|
107
|
-
'**/.*rc.{js,ts,mjs,cjs}',
|
|
108
|
-
'eslint.config.*',
|
|
109
|
-
'.lintstagedrc.*',
|
|
110
|
-
'tsup.config.*',
|
|
111
|
-
'vitest.config.*',
|
|
112
|
-
'jest.config.*',
|
|
113
|
-
'tailwind.config.*',
|
|
114
|
-
'postcss.config.*',
|
|
115
|
-
'next.config.*',
|
|
116
|
-
'commitlint.config.*',
|
|
117
|
-
'prettier.config.*',
|
|
118
|
-
],
|
|
119
|
-
languageOptions: {
|
|
120
|
-
parserOptions: {
|
|
121
|
-
projectService: false,
|
|
122
|
-
},
|
|
123
|
-
},
|
|
126
|
+
files: ['**/*.config.ts', '**/*.config.mts', '**/*.config.cts'],
|
|
124
127
|
rules: {
|
|
125
|
-
// Disable type-aware rules (no tsconfig for these files)
|
|
126
|
-
'@typescript-eslint/no-unsafe-assignment': 'off',
|
|
127
|
-
'@typescript-eslint/no-unsafe-member-access': 'off',
|
|
128
|
-
'@typescript-eslint/no-unsafe-call': 'off',
|
|
129
|
-
'@typescript-eslint/no-unsafe-return': 'off',
|
|
130
|
-
'@typescript-eslint/no-unsafe-argument': 'off',
|
|
131
|
-
'@typescript-eslint/require-await': 'off',
|
|
132
|
-
'@typescript-eslint/no-floating-promises': 'off',
|
|
133
|
-
'@typescript-eslint/await-thenable': 'off',
|
|
134
|
-
'@typescript-eslint/no-misused-promises': 'off',
|
|
135
|
-
'@typescript-eslint/no-unnecessary-condition': 'off',
|
|
136
|
-
'@typescript-eslint/strict-boolean-expressions': 'off',
|
|
137
|
-
'@typescript-eslint/consistent-type-exports': 'off',
|
|
138
|
-
// Relax strictness for config files
|
|
139
|
-
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
140
|
-
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
141
|
-
// Config files require default exports
|
|
142
|
-
'import/no-default-export': 'off',
|
|
143
|
-
// Allow console in config files
|
|
144
|
-
'no-console': 'off',
|
|
145
|
-
// Allow relative imports in config files (they often need it)
|
|
146
128
|
'no-restricted-imports': 'off',
|
|
147
129
|
},
|
|
148
130
|
},
|
package/base.js
CHANGED
|
@@ -69,6 +69,22 @@ export const base = [
|
|
|
69
69
|
'**/public/**',
|
|
70
70
|
],
|
|
71
71
|
},
|
|
72
|
+
// Relaxations for config files
|
|
73
|
+
{
|
|
74
|
+
name: 'vortiquo/base/config-files',
|
|
75
|
+
files: [
|
|
76
|
+
'**/*.config.{js,ts,mjs,cjs}',
|
|
77
|
+
'**/.*rc.{js,ts,mjs,cjs}',
|
|
78
|
+
'eslint.config.*',
|
|
79
|
+
'.lintstagedrc.*',
|
|
80
|
+
],
|
|
81
|
+
rules: {
|
|
82
|
+
// Config files require default exports
|
|
83
|
+
'import/no-default-export': 'off',
|
|
84
|
+
// Allow console in config files
|
|
85
|
+
'no-console': 'off',
|
|
86
|
+
},
|
|
87
|
+
},
|
|
72
88
|
];
|
|
73
89
|
|
|
74
90
|
export default base;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vortiquo/eslint-config",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1-beta.1",
|
|
4
4
|
"description": "Modern ESLint v9 flat configurations with TypeScript, React, Next.js, and Node.js support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
"lint": "ls-lint",
|
|
15
15
|
"format": "prettier --write .",
|
|
16
16
|
"format:check": "prettier --check .",
|
|
17
|
+
"test": "node scripts/validate-configs.js",
|
|
18
|
+
"prepack": "node scripts/validate-configs.js",
|
|
17
19
|
"commit": "cz",
|
|
18
20
|
"prepare": "husky"
|
|
19
21
|
},
|