-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy patheslint.config.mjs
More file actions
110 lines (105 loc) · 3.72 KB
/
Copy patheslint.config.mjs
File metadata and controls
110 lines (105 loc) · 3.72 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
// ███████╗██╗ ██╗ █████╗ ███╗ ███╗██████╗ ██╗ ███████╗███████╗
// ██╔════╝╚██╗██╔╝██╔══██╗████╗ ████║██╔══██╗██║ ██╔════╝██╔════╝
// █████╗ ╚███╔╝ ███████║██╔████╔██║██████╔╝██║ █████╗ ███████╗
// ██╔══╝ ██╔██╗ ██╔══██║██║╚██╔╝██║██╔═══╝ ██║ ██╔══╝ ╚════██║
// ███████╗██╔╝ ██╗██║ ██║██║ ╚═╝ ██║██║ ███████╗███████╗███████║
// ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚══════╝╚══════╝╚══════╝
import babelParser from '@babel/eslint-parser'
import js from '@eslint/js'
import globals from 'globals'
import local from './scripts/lib/eslint-style-rules.mjs'
const babelTypeScript = (plugins) => ({
parser: babelParser,
parserOptions: {
requireConfigFile: false,
babelOptions: {babelrc: false, configFile: false, parserOpts: {plugins}}
}
})
const templateOnlyRules = {
rules: {'ban-ts-comment': {create: () => ({})}}
}
const commentRules = (allowBanner) => ({
'local/no-file-header-comment': ['error', {allowBanner}],
'local/no-divider-comment': ['error', {allowBanner}],
'local/no-jsdoc-description': 'error'
})
export default [
{
languageOptions: {
globals: {
...globals.browser,
...globals.webextensions,
...globals.node
}
}
},
{
files: ['**/*.{js,mjs,cjs}'],
...js.configs.recommended
},
{
files: ['**/*.jsx'],
languageOptions: {parserOptions: {ecmaFeatures: {jsx: true}}}
},
{
files: ['**/*.{ts,mts,cts}'],
languageOptions: babelTypeScript([['typescript', {}]])
},
{
files: ['**/*.d.ts'],
languageOptions: babelTypeScript([['typescript', {dts: true}]])
},
{
files: ['examples/*/**'],
plugins: {'@typescript-eslint': templateOnlyRules},
linterOptions: {reportUnusedDisableDirectives: 'off'}
},
{
files: ['**/*.tsx'],
languageOptions: babelTypeScript([['typescript', {}], 'jsx'])
},
{
files: ['**/*.{js,jsx,mjs,cjs,ts,tsx,mts,cts}'],
plugins: {local},
rules: {
curly: ['error', 'multi-line'],
'local/padding-line-between-statements': [
'error',
{blankLine: 'always', prev: '*', next: ['return', 'throw']},
{blankLine: 'always', prev: 'if', next: '*'},
{blankLine: 'any', prev: 'if', next: 'if'},
{blankLine: 'always', prev: '*', next: 'block-like'},
{blankLine: 'always', prev: 'block-like', next: '*'},
{blankLine: 'always', prev: 'multiline-expression', next: '*'},
{blankLine: 'any', prev: '*', next: 'empty'},
{blankLine: 'any', prev: 'empty', next: '*'}
],
'local/blank-line-after-shebang': 'error'
}
},
{
files: ['scripts/**/*.{js,mjs,cjs,ts}', 'examples/*.ts'],
rules: commentRules(false)
},
{
files: ['*.{js,mjs,cjs,ts}'],
rules: commentRules(true)
},
{
ignores: [
'templates-meta.d.ts',
'templates/',
'artifacts/',
'.local-fixtures/',
'**/dist/',
'.prod-dist/',
'.source-guard/',
'**/e2e-report/',
'**/coverage/',
'**/webpack.config.js',
'**/postcss.config.js',
'**/tailwind.config.js',
'**/stylelint.config.json'
]
}
]