forked from PrismJS/prism
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.eslintrc.js
More file actions
179 lines (173 loc) · 3.75 KB
/
.eslintrc.js
File metadata and controls
179 lines (173 loc) · 3.75 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
/** @type {import('eslint').Linter.Config} */
module.exports = {
root: true,
plugins: ['jsdoc'],
extends: 'eslint:recommended',
rules: {
'no-use-before-define': ['error', { 'functions': false, 'classes': false }],
// stylistic rules
'brace-style': ['warn', '1tbs', { allowSingleLine: true }],
'no-tabs': ['warn', { allowIndentationTabs: true }],
'no-var': 'error',
'quotes': ['warn', 'single', { avoidEscape: true, allowTemplateLiterals: true }],
'semi': 'warn',
'wrap-iife': 'warn',
// spaces
'arrow-spacing': 'warn',
'block-spacing': 'warn',
'comma-spacing': 'warn',
'computed-property-spacing': 'warn',
'func-call-spacing': 'warn',
'generator-star-spacing': 'warn',
'key-spacing': 'warn',
'keyword-spacing': 'warn',
'no-multi-spaces': ['warn', { ignoreEOLComments: true }],
'no-trailing-spaces': 'warn',
'no-whitespace-before-property': 'warn',
'object-curly-spacing': ['warn', 'always'],
'rest-spread-spacing': 'warn',
'semi-spacing': 'warn',
'space-before-blocks': 'warn',
'space-before-function-paren': ['warn', { named: 'never' }],
'space-in-parens': 'warn',
'space-infix-ops': ['warn', { int32Hint: true }],
'space-unary-ops': 'warn',
'switch-colon-spacing': 'warn',
'template-curly-spacing': 'warn',
'yield-star-spacing': 'warn',
// JSDoc
'jsdoc/check-alignment': 'warn',
'jsdoc/check-syntax': 'warn',
'jsdoc/check-param-names': 'warn',
'jsdoc/require-hyphen-before-param-description': ['warn', 'never'],
'jsdoc/check-tag-names': 'warn',
'jsdoc/check-types': 'warn',
'jsdoc/empty-tags': 'warn',
'jsdoc/newline-after-description': 'warn',
'jsdoc/require-param-name': 'warn',
'jsdoc/require-property-name': 'warn',
// I turned this rule off because we use `hasOwnProperty` in a lot of places
// TODO: Think about re-enabling this rule
'no-prototype-builtins': 'off',
// TODO: Think about re-enabling this rule
'no-inner-declarations': 'off',
// TODO: Think about re-enabling this rule
'no-sparse-arrays': 'off',
// turning off some regex rules
// these are supposed to protect against accidental use but we need those quite often
'no-control-regex': 'off',
'no-empty-character-class': 'off',
'no-useless-escape': 'off'
},
settings: {
jsdoc: { mode: 'typescript' }
},
ignorePatterns: [
'*.min.js',
'vendor/',
'docs/',
'components.js',
'prism.js',
'node_modules'
],
overrides: [
{
// Languages and plugins
files: [
'components/*.js',
'plugins/*/prism-*.js'
],
excludedFiles: 'components/index.js',
env: {
browser: true,
node: true,
worker: true
},
globals: {
'Prism': true
},
rules: {
'no-var': 'off'
}
},
{
// `loadLanguages` function for Node.js
files: 'components/index.js',
env: {
es6: true,
node: true
},
parserOptions: {
ecmaVersion: 6
},
globals: {
'Prism': true
}
},
{
// Gulp and Danger
files: 'dependencies.js',
env: {
browser: true,
node: true
},
rules: {
'no-var': 'off'
}
},
{
// The scripts that run on our website
files: 'assets/*.js',
env: {
browser: true
},
globals: {
'components': true,
'getLoader': true,
'PrefixFree': true,
'Prism': true,
'Promise': true,
'saveAs': true,
'$': true,
'$$': true,
'$u': true
},
rules: {
'no-var': 'off'
}
},
{
// Test files
files: 'tests/**',
env: {
es6: true,
mocha: true,
node: true
},
parserOptions: {
ecmaVersion: 2018
}
},
{
// Gulp and Danger
files: [
'gulpfile.js/**',
'dangerfile.js'
],
env: {
es6: true,
node: true
},
parserOptions: {
ecmaVersion: 2018
}
},
{
// This file
files: '.eslintrc.js',
env: {
node: true
}
},
]
};