eslint-config-gristow 3.0.0-alpha.1 → 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.
- package/eslint.config.js +19 -82
- package/index.js +105 -1
- package/package.json +1 -1
package/eslint.config.js
CHANGED
|
@@ -1,96 +1,33 @@
|
|
|
1
1
|
// @ts-check
|
|
2
|
-
import { defineConfig } from 'eslint/config';
|
|
3
|
-
import eslint from '@eslint/js';
|
|
4
|
-
import tseslint from 'typescript-eslint';
|
|
5
|
-
import eslintConfigPrettier from 'eslint-config-prettier';
|
|
6
|
-
import importPlugin from 'eslint-plugin-import';
|
|
7
|
-
import globals from 'globals';
|
|
8
|
-
|
|
9
|
-
// Import our custom rule sets
|
|
10
|
-
import airbnbBaseRules from './rules/airbnb-base-rules.js';
|
|
11
|
-
import sharedRules from './rules/shared-rules.js';
|
|
12
|
-
import importRules from './rules/import-rules.js';
|
|
13
|
-
import typescriptOnlyRules from './rules/typescript-only-rules.js';
|
|
14
|
-
|
|
15
2
|
/**
|
|
16
|
-
* ESLint
|
|
17
|
-
*
|
|
18
|
-
* This configuration provides:
|
|
19
|
-
* - ESLint recommended rules
|
|
20
|
-
* - TypeScript-ESLint recommended rules
|
|
21
|
-
* - Airbnb-style rules (custom implementation for ESLint 9)
|
|
22
|
-
* - Prettier compatibility
|
|
23
|
-
* - Import plugin rules
|
|
3
|
+
* ESLint config for the eslint-config-gristow project itself.
|
|
4
|
+
* Extends the base config and adds allowDefaultProject for test files.
|
|
24
5
|
*/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
{
|
|
28
|
-
ignores: [
|
|
29
|
-
'**/node_modules/**',
|
|
30
|
-
'**/dist/**',
|
|
31
|
-
'**/build/**',
|
|
32
|
-
'**/.svelte-kit/**',
|
|
33
|
-
],
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
// Base ESLint recommended
|
|
37
|
-
eslint.configs.recommended,
|
|
6
|
+
import { defineConfig } from 'eslint/config';
|
|
7
|
+
import baseConfig from './index.js';
|
|
38
8
|
|
|
39
|
-
|
|
40
|
-
|
|
9
|
+
export default defineConfig(
|
|
10
|
+
// Use our own base config
|
|
11
|
+
baseConfig,
|
|
41
12
|
|
|
42
|
-
//
|
|
13
|
+
// Override to allow test files that aren't in tsconfig
|
|
43
14
|
{
|
|
44
|
-
plugins: {
|
|
45
|
-
'@typescript-eslint': tseslint.plugin,
|
|
46
|
-
'import': importPlugin,
|
|
47
|
-
},
|
|
48
15
|
languageOptions: {
|
|
49
|
-
parser: tseslint.parser,
|
|
50
16
|
parserOptions: {
|
|
51
|
-
sourceType: 'module',
|
|
52
|
-
ecmaVersion: 2020,
|
|
53
17
|
projectService: {
|
|
54
|
-
allowDefaultProject: [
|
|
18
|
+
allowDefaultProject: [
|
|
19
|
+
'*.config.js',
|
|
20
|
+
'*.config.cjs',
|
|
21
|
+
'*.config.mjs',
|
|
22
|
+
'*.config.ts',
|
|
23
|
+
'.*.js',
|
|
24
|
+
'.*.cjs',
|
|
25
|
+
'.*.mjs',
|
|
26
|
+
'test/sample.js',
|
|
27
|
+
'test/fixtures/*.js',
|
|
28
|
+
],
|
|
55
29
|
},
|
|
56
30
|
},
|
|
57
|
-
globals: {
|
|
58
|
-
...globals.browser,
|
|
59
|
-
...globals.es2017,
|
|
60
|
-
...globals.node,
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
settings: {
|
|
64
|
-
'import/parsers': {
|
|
65
|
-
'@typescript-eslint/parser': ['.ts', '.tsx'],
|
|
66
|
-
},
|
|
67
|
-
'import/resolver': {
|
|
68
|
-
typescript: true,
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
rules: {
|
|
72
|
-
// Apply Airbnb base rules first
|
|
73
|
-
...airbnbBaseRules,
|
|
74
|
-
// Then our shared rules (which override some Airbnb rules)
|
|
75
|
-
...sharedRules,
|
|
76
|
-
// Then import-specific rules
|
|
77
|
-
...importRules,
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
// TypeScript-specific overrides
|
|
82
|
-
{
|
|
83
|
-
files: ['**/*.ts', '**/*.tsx'],
|
|
84
|
-
rules: typescriptOnlyRules,
|
|
85
|
-
},
|
|
86
|
-
|
|
87
|
-
// Prettier must be last to override formatting rules
|
|
88
|
-
eslintConfigPrettier,
|
|
89
|
-
|
|
90
|
-
// Re-enable curly after Prettier (we want this enforced for code safety)
|
|
91
|
-
{
|
|
92
|
-
rules: {
|
|
93
|
-
curly: ['error', 'all'],
|
|
94
31
|
},
|
|
95
32
|
},
|
|
96
33
|
);
|
package/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// @ts-check
|
|
1
2
|
/**
|
|
2
3
|
* eslint-config-gristow
|
|
3
4
|
*
|
|
@@ -15,4 +16,107 @@
|
|
|
15
16
|
* );
|
|
16
17
|
* ```
|
|
17
18
|
*/
|
|
18
|
-
|
|
19
|
+
import { defineConfig } from 'eslint/config';
|
|
20
|
+
import eslint from '@eslint/js';
|
|
21
|
+
import tseslint from 'typescript-eslint';
|
|
22
|
+
import eslintConfigPrettier from 'eslint-config-prettier';
|
|
23
|
+
import importPlugin from 'eslint-plugin-import';
|
|
24
|
+
import globals from 'globals';
|
|
25
|
+
|
|
26
|
+
// Import our custom rule sets
|
|
27
|
+
import airbnbBaseRules from './rules/airbnb-base-rules.js';
|
|
28
|
+
import sharedRules from './rules/shared-rules.js';
|
|
29
|
+
import importRules from './rules/import-rules.js';
|
|
30
|
+
import typescriptOnlyRules from './rules/typescript-only-rules.js';
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* ESLint flat config for eslint-config-gristow
|
|
34
|
+
*
|
|
35
|
+
* This configuration provides:
|
|
36
|
+
* - ESLint recommended rules
|
|
37
|
+
* - TypeScript-ESLint recommended rules
|
|
38
|
+
* - Airbnb-style rules (custom implementation for ESLint 9)
|
|
39
|
+
* - Prettier compatibility
|
|
40
|
+
* - Import plugin rules
|
|
41
|
+
*/
|
|
42
|
+
export default defineConfig(
|
|
43
|
+
// Global ignores
|
|
44
|
+
{
|
|
45
|
+
ignores: [
|
|
46
|
+
'**/node_modules/**',
|
|
47
|
+
'**/dist/**',
|
|
48
|
+
'**/build/**',
|
|
49
|
+
'**/.svelte-kit/**',
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
// Base ESLint recommended
|
|
54
|
+
eslint.configs.recommended,
|
|
55
|
+
|
|
56
|
+
// TypeScript recommended
|
|
57
|
+
tseslint.configs.recommended,
|
|
58
|
+
|
|
59
|
+
// Main configuration
|
|
60
|
+
{
|
|
61
|
+
plugins: {
|
|
62
|
+
'@typescript-eslint': tseslint.plugin,
|
|
63
|
+
'import': importPlugin,
|
|
64
|
+
},
|
|
65
|
+
languageOptions: {
|
|
66
|
+
parser: tseslint.parser,
|
|
67
|
+
parserOptions: {
|
|
68
|
+
sourceType: 'module',
|
|
69
|
+
ecmaVersion: 2020,
|
|
70
|
+
projectService: {
|
|
71
|
+
// Allow common config files to be linted without being in tsconfig
|
|
72
|
+
allowDefaultProject: [
|
|
73
|
+
'*.config.js',
|
|
74
|
+
'*.config.cjs',
|
|
75
|
+
'*.config.mjs',
|
|
76
|
+
'*.config.ts',
|
|
77
|
+
'.*.js',
|
|
78
|
+
'.*.cjs',
|
|
79
|
+
'.*.mjs',
|
|
80
|
+
],
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
globals: {
|
|
84
|
+
...globals.browser,
|
|
85
|
+
...globals.es2017,
|
|
86
|
+
...globals.node,
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
settings: {
|
|
90
|
+
'import/parsers': {
|
|
91
|
+
'@typescript-eslint/parser': ['.ts', '.tsx'],
|
|
92
|
+
},
|
|
93
|
+
'import/resolver': {
|
|
94
|
+
typescript: true,
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
rules: {
|
|
98
|
+
// Apply Airbnb base rules first
|
|
99
|
+
...airbnbBaseRules,
|
|
100
|
+
// Then our shared rules (which override some Airbnb rules)
|
|
101
|
+
...sharedRules,
|
|
102
|
+
// Then import-specific rules
|
|
103
|
+
...importRules,
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
// TypeScript-specific overrides
|
|
108
|
+
{
|
|
109
|
+
files: ['**/*.ts', '**/*.tsx'],
|
|
110
|
+
rules: typescriptOnlyRules,
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
// Prettier must be last to override formatting rules
|
|
114
|
+
eslintConfigPrettier,
|
|
115
|
+
|
|
116
|
+
// Re-enable curly after Prettier (we want this enforced for code safety)
|
|
117
|
+
{
|
|
118
|
+
rules: {
|
|
119
|
+
curly: ['error', 'all'],
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
);
|