-
Notifications
You must be signed in to change notification settings - Fork 194
Expand file tree
/
Copy patheslint.config.js
More file actions
136 lines (129 loc) · 3.5 KB
/
eslint.config.js
File metadata and controls
136 lines (129 loc) · 3.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
import eslintPlugin from '@eslint/js';
import eslintConfigPrettier from 'eslint-config-prettier/flat';
import googleappsscript from 'eslint-plugin-googleappsscript';
import { importX } from 'eslint-plugin-import-x';
import { configs as jsoncConfigs } from 'eslint-plugin-jsonc';
import pluginSimpleImportSort from 'eslint-plugin-simple-import-sort';
import globals from 'globals';
export default [
eslintPlugin.configs.recommended,
importX.flatConfigs.recommended,
{ ignores: ['dist/**', 'build/**', 'node_modules/**', 'package-lock.json'] },
{
files: ['**/*.js'],
plugins: {
'simple-import-sort': pluginSimpleImportSort,
googleappsscript,
},
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
OAuth1: true,
OAuth2: true,
google: true,
...globals.node,
...googleappsscript.environments.googleappsscript.globals,
},
},
rules: {
'no-continue': 'off',
'no-console': 'warn',
'no-underscore-dangle': 'off',
'no-unused-vars': [
'warn',
{
ignoreRestSiblings: true,
argsIgnorePattern: 'res|next|^err|^ignore|^_',
caughtErrors: 'none',
},
],
'no-unused-expressions': 'warn',
'no-var': 'error',
'prefer-const': 'error',
'prefer-template': 'error',
'no-use-before-define': 'error',
'prefer-arrow-callback': 'error',
'arrow-spacing': 'error',
'no-duplicate-imports': 'error',
'no-useless-rename': 'error',
'object-shorthand': 'error',
'prefer-destructuring': [
'error',
{
array: true,
object: true,
},
{
enforceForRenamedProperties: false,
},
],
// Naming conventions
camelcase: 'off',
// Import/export rules
'import-x/no-extraneous-dependencies': 'warn',
'import-x/extensions': ['error', 'ignorePackages'],
'import-x/no-unresolved': 'off', // Disabled for Apps Script compatibility
'import-x/no-cycle': 'off',
'import-x/no-self-import': 'error',
'import-x/no-useless-path-segments': 'error',
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',
},
},
...jsoncConfigs['flat/recommended-with-jsonc'],
{
files: ['**/*.json', '**/*.jsonc'],
rules: {
'jsonc/sort-keys': 'error',
'jsonc/no-dupe-keys': 'error',
'jsonc/no-comments': 'off', // Allow comments in JSON files
},
},
{
files: ['**/*.test.js', '**/*.spec.js', '**/__tests__/**/*.js'],
languageOptions: {
globals: {
...globals.jest,
...globals.jasmine,
},
},
rules: {
'no-console': 'off', // Allow console in tests
'import-x/no-extraneous-dependencies': [
'error',
{
devDependencies: true,
optionalDependencies: false,
peerDependencies: false,
},
],
},
},
{
files: ['*.config.js', 'vite.config.js', 'eslint.config.js', 'jest.config.js'],
languageOptions: {
globals: {
...globals.node,
},
},
rules: {
'import-x/no-extraneous-dependencies': [
'error',
{
devDependencies: true,
},
],
},
},
{
files: ['**/*.html'],
languageOptions: {
globals: {
...globals.browser,
},
},
},
// Must be last: turns off ESLint stylistic rules that conflict with Prettier (.prettierrc).
eslintConfigPrettier,
];