Skip to content

Commit 2868a8f

Browse files
committed
Improved ESLint configuration
1 parent c5cd5f8 commit 2868a8f

File tree

5 files changed

+208
-41
lines changed

5 files changed

+208
-41
lines changed

eslint.config.js

Lines changed: 86 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default [
1717
prettier: prettierPlugin,
1818
import: importPlugin,
1919
'simple-import-sort': pluginSimpleImportSort,
20-
googleappsscript: googleappsscript,
20+
googleappsscript,
2121
},
2222
languageOptions: {
2323
ecmaVersion: 'latest',
@@ -35,34 +35,113 @@ export default [
3535
'no-continue': 'off',
3636
'no-console': 'warn',
3737
'no-underscore-dangle': 'off',
38+
'no-unused-vars': [
39+
'warn',
40+
{
41+
ignoreRestSiblings: true,
42+
argsIgnorePattern: 'res|next|^err|^ignore|^_',
43+
caughtErrors: 'none',
44+
},
45+
],
46+
'no-unused-expressions': 'warn',
47+
'no-var': 'error',
48+
'prefer-const': 'error',
3849
'prefer-template': 'error',
50+
'prefer-arrow-callback': 'error',
51+
'arrow-spacing': 'error',
52+
'no-duplicate-imports': 'error',
53+
'no-useless-rename': 'error',
54+
'object-shorthand': 'error',
55+
'prefer-destructuring': [
56+
'error',
57+
{
58+
array: true,
59+
object: true,
60+
},
61+
{
62+
enforceForRenamedProperties: false,
63+
},
64+
],
65+
66+
// Naming conventions
3967
camelcase: 'off',
68+
69+
// Import/export rules
4070
'import/prefer-default-export': 'off',
4171
'import/no-extraneous-dependencies': 'warn',
4272
'import/extensions': ['error', 'ignorePackages'],
73+
'import/no-unresolved': 'off', // Disabled for Apps Script compatibility
74+
'import/no-cycle': 'warn',
75+
'import/no-self-import': 'error',
76+
'import/no-useless-path-segments': 'error',
4377
'simple-import-sort/imports': 'error',
4478
'simple-import-sort/exports': 'error',
45-
'no-unused-vars': [
46-
'warn',
79+
'prettier/prettier': [
80+
'error',
4781
{
48-
ignoreRestSiblings: true,
49-
argsIgnorePattern: 'res|next|^err|^ignore|^_',
50-
caughtErrors: 'none',
82+
trailingComma: 'es5',
83+
singleQuote: true,
84+
printWidth: 120,
85+
endOfLine: 'auto',
86+
semi: true,
87+
tabWidth: 2,
5188
},
5289
],
5390
},
5491
},
92+
5593
...jsoncPlugin.configs['flat/recommended-with-jsonc'],
5694
{
95+
files: ['**/*.json', '**/*.jsonc'],
5796
rules: {
5897
'jsonc/sort-keys': 'error',
98+
'jsonc/no-dupe-keys': 'error',
99+
'jsonc/no-comments': 'off', // Allow comments in JSON files
59100
},
60101
},
102+
61103
{
62-
files: ['**/*.test.js'],
104+
files: ['**/*.test.js', '**/*.spec.js', '**/__tests__/**/*.js'],
63105
languageOptions: {
64106
globals: {
65107
...globals.jest,
108+
...globals.jasmine,
109+
},
110+
},
111+
rules: {
112+
'no-console': 'off', // Allow console in tests
113+
'import/no-extraneous-dependencies': [
114+
'error',
115+
{
116+
devDependencies: true,
117+
optionalDependencies: false,
118+
peerDependencies: false,
119+
},
120+
],
121+
},
122+
},
123+
124+
{
125+
files: ['*.config.js', 'vite.config.js', 'eslint.config.js', 'jest.config.js'],
126+
languageOptions: {
127+
globals: {
128+
...globals.node,
129+
},
130+
},
131+
rules: {
132+
'import/no-extraneous-dependencies': [
133+
'error',
134+
{
135+
devDependencies: true,
136+
},
137+
],
138+
},
139+
},
140+
{
141+
files: ['**/*.html'],
142+
languageOptions: {
143+
globals: {
144+
...globals.browser,
66145
},
67146
},
68147
},

0 commit comments

Comments
 (0)