Skip to content

Commit 339bf68

Browse files
authored
Merge pull request #13156 from hasezoey/eslintMarkdownCode
[DOCS] Add* and run `eslint-plugin-markdown`
2 parents c05ba1a + 0903cd4 commit 339bf68

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+740
-693
lines changed

.eslintrc.js

Lines changed: 232 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,232 @@
1+
'use strict';
2+
3+
module.exports = {
4+
extends: [
5+
'eslint:recommended'
6+
],
7+
ignorePatterns: [
8+
'tools',
9+
'dist',
10+
'website.js',
11+
'test/files/*',
12+
'benchmarks',
13+
'*.min.js',
14+
'docs/js/native.js'
15+
],
16+
overrides: [
17+
{
18+
files: [
19+
'**/*.{ts,tsx}',
20+
'**/*.md/*.ts',
21+
'**/*.md/*.typescript'
22+
],
23+
extends: [
24+
'plugin:@typescript-eslint/eslint-recommended',
25+
'plugin:@typescript-eslint/recommended'
26+
],
27+
plugins: [
28+
'@typescript-eslint'
29+
],
30+
rules: {
31+
'@typescript-eslint/triple-slash-reference': 'off',
32+
'@typescript-eslint/no-non-null-assertion': 'off',
33+
'@typescript-eslint/no-empty-function': 'off',
34+
'spaced-comment': [
35+
'error',
36+
'always',
37+
{
38+
block: {
39+
markers: [
40+
'!'
41+
],
42+
balanced: true
43+
},
44+
markers: [
45+
'/'
46+
]
47+
}
48+
],
49+
'@typescript-eslint/no-explicit-any': 'off',
50+
'@typescript-eslint/ban-types': 'off',
51+
'@typescript-eslint/no-unused-vars': 'off',
52+
'@typescript-eslint/explicit-module-boundary-types': 'off',
53+
'@typescript-eslint/indent': [
54+
'warn',
55+
2,
56+
{
57+
SwitchCase: 1,
58+
ignoredNodes: ['TSTypeParameterInstantiation']
59+
}
60+
],
61+
'@typescript-eslint/prefer-optional-chain': 'error',
62+
'@typescript-eslint/brace-style': 'error',
63+
'@typescript-eslint/no-dupe-class-members': 'error',
64+
'@typescript-eslint/no-redeclare': 'error',
65+
'@typescript-eslint/type-annotation-spacing': 'error',
66+
'@typescript-eslint/object-curly-spacing': [
67+
'error',
68+
'always'
69+
],
70+
'@typescript-eslint/semi': 'error',
71+
'@typescript-eslint/space-before-function-paren': [
72+
'error',
73+
'never'
74+
],
75+
'@typescript-eslint/space-infix-ops': 'off'
76+
}
77+
},
78+
{
79+
files: [
80+
'docs/js/**/*.js'
81+
],
82+
env: {
83+
node: false,
84+
browser: true
85+
}
86+
}
87+
// // eslint-plugin-markdown has been disabled because of out-standing issues, see https://github.com/eslint/eslint-plugin-markdown/issues/214
88+
// {
89+
// files: ['**/*.md'],
90+
// processor: 'markdown/markdown'
91+
// },
92+
// {
93+
// files: ['**/*.md/*.js', '**/*.md/*.javascript', '**/*.md/*.ts', '**/*.md/*.typescript'],
94+
// parserOptions: {
95+
// ecmaFeatures: {
96+
// impliedStrict: true
97+
// },
98+
// sourceType: 'module', // required to allow "import" statements
99+
// ecmaVersion: 'latest' // required to allow top-level await
100+
// },
101+
// rules: {
102+
// 'no-undef': 'off',
103+
// 'no-unused-expressions': 'off',
104+
// 'no-unused-vars': 'off',
105+
// 'no-redeclare': 'off',
106+
// '@typescript-eslint/no-redeclare': 'off'
107+
// }
108+
// }
109+
],
110+
plugins: [
111+
'mocha-no-only'
112+
// 'markdown'
113+
],
114+
parserOptions: {
115+
ecmaVersion: 2020
116+
},
117+
env: {
118+
node: true,
119+
es6: true
120+
},
121+
rules: {
122+
'comma-style': 'error',
123+
indent: [
124+
'error',
125+
2,
126+
{
127+
SwitchCase: 1,
128+
VariableDeclarator: 2
129+
}
130+
],
131+
'keyword-spacing': 'error',
132+
'no-whitespace-before-property': 'error',
133+
'no-buffer-constructor': 'warn',
134+
'no-console': 'off',
135+
'no-constant-condition': 'off',
136+
'no-multi-spaces': 'error',
137+
'func-call-spacing': 'error',
138+
'no-trailing-spaces': 'error',
139+
'no-undef': 'error',
140+
'no-unneeded-ternary': 'error',
141+
'no-const-assign': 'error',
142+
'no-useless-rename': 'error',
143+
'no-dupe-keys': 'error',
144+
'space-in-parens': [
145+
'error',
146+
'never'
147+
],
148+
'spaced-comment': [
149+
'error',
150+
'always',
151+
{
152+
block: {
153+
markers: [
154+
'!'
155+
],
156+
balanced: true
157+
}
158+
}
159+
],
160+
'key-spacing': [
161+
'error',
162+
{
163+
beforeColon: false,
164+
afterColon: true
165+
}
166+
],
167+
'comma-spacing': [
168+
'error',
169+
{
170+
before: false,
171+
after: true
172+
}
173+
],
174+
'array-bracket-spacing': 1,
175+
'arrow-spacing': [
176+
'error',
177+
{
178+
before: true,
179+
after: true
180+
}
181+
],
182+
'object-curly-spacing': [
183+
'error',
184+
'always'
185+
],
186+
'comma-dangle': [
187+
'error',
188+
'never'
189+
],
190+
'no-unreachable': 'error',
191+
quotes: [
192+
'error',
193+
'single'
194+
],
195+
'quote-props': [
196+
'error',
197+
'as-needed'
198+
],
199+
semi: 'error',
200+
'no-extra-semi': 'error',
201+
'semi-spacing': 'error',
202+
'no-spaced-func': 'error',
203+
'no-throw-literal': 'error',
204+
'space-before-blocks': 'error',
205+
'space-before-function-paren': [
206+
'error',
207+
'never'
208+
],
209+
'space-infix-ops': 'error',
210+
'space-unary-ops': 'error',
211+
'no-var': 'warn',
212+
'prefer-const': 'warn',
213+
strict: [
214+
'error',
215+
'global'
216+
],
217+
'no-restricted-globals': [
218+
'error',
219+
{
220+
name: 'context',
221+
message: 'Don\'t use Mocha\'s global context'
222+
}
223+
],
224+
'no-prototype-builtins': 'off',
225+
'mocha-no-only/mocha-no-only': [
226+
'error'
227+
],
228+
'no-empty': 'off',
229+
'eol-last': 'warn',
230+
'no-multiple-empty-lines': ['warn', { max: 2 }]
231+
}
232+
};

0 commit comments

Comments
 (0)