-
-
Notifications
You must be signed in to change notification settings - Fork 44
/
eslint.config.js
171 lines (168 loc) · 4.84 KB
/
eslint.config.js
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
import eslint from '@eslint/js';
import globals from 'globals';
import tseslint from 'typescript-eslint';
import security from "eslint-plugin-security";
import stylistic from '@stylistic/eslint-plugin';
import jsdoc from 'eslint-plugin-jsdoc';
import html from 'eslint-plugin-html';
const jsConfigs = [
eslint.configs.recommended,
security.configs.recommended,
jsdoc.configs['flat/recommended'],
{
"ignores": [
"min/*.js",
"examples/**/*.js",
]
},
{
"files": [
"Hyphenopoly_Loader.js",
"Hyphenopoly.js",
"testsuite/testdriver.js",
"testsuite/*.html"
],
"ignores": [
"testsuite/test28.html"
],
"languageOptions": {
"ecmaVersion": "latest",
"globals": {
...globals.browser
},
"sourceType": "script",
},
"name": "browser",
"plugins": {
html
}
},
{
"files": [
"hyphenopoly.module.js",
"test/*.js"
],
"languageOptions": {
"ecmaVersion": "latest",
"globals": {
...globals.node
},
"sourceType": "module"
},
"name": "modules"
},
{
"name": "shared rules",
"plugins": {
'@stylistic': stylistic
},
"rules": {
"@stylistic/array-element-newline": [1, "consistent"],
"@stylistic/function-call-argument-newline": [1, "consistent"],
"@stylistic/function-paren-newline": [1, "consistent"],
"@stylistic/lines-around-comment": [1, {"allowBlockStart": true}],
"@stylistic/max-len": [
1,
{
"ignoreStrings": true,
"ignoreTemplateLiterals": true
}
],
"@stylistic/padded-blocks": [1, "never"],
"@stylistic/space-before-function-paren": [
1,
{
"anonymous": "always",
"asyncArrow": "always",
"named": "never"
}
],
"@stylistic/wrap-iife": 1,
"arrow-body-style": [1, "always"],
"complexity": [1, 10],
"func-names": [1, "as-needed"],
"func-style": [1, "declaration", {"allowArrowFunctions": true}],
"id-length": 0,
"jsdoc/require-jsdoc": [
1,
{
"require": {
"ArrowFunctionExpression": true,
"ClassDeclaration": true,
"FunctionDeclaration": true,
"FunctionExpression": true,
"MethodDefinition": true
}
}
],
"logical-assignment-operators": [1, "always", {"enforceForIfStatements": true}],
"max-params": [1, 5],
"no-bitwise": 2,
"no-console": 2,
"no-magic-numbers": 0,
"no-param-reassign": 0,
"no-restricted-properties": [
"error",
{
"message": "Use .slice instead of .substr.",
"property": "substr"
}
],
"no-template-curly-in-string": 2,
"object-shorthand": 1,
"one-var": 0,
"prefer-arrow-callback": 1,
"prefer-destructuring": 0,
"prefer-named-capture-group": 0,
"prefer-template": 0,
"require-unicode-regexp": 0,
"sort-keys": [1, "asc", {"caseSensitive": false}]
}
},
{
"files": [
"testsuite/*.html"
],
"languageOptions": {
"ecmaVersion": "latest",
"globals": {
...globals.browser,
"Hyphenopoly": "readable"
},
"sourceType": "script",
},
"name": "inline",
"plugins": {
html
},
"rules": {
"jsdoc/require-jsdoc": 0,
"sort-keys": 0
}
}
];
const asConfigs = tseslint.config({
"extends": [
eslint.configs.recommended,
...tseslint.configs.strictTypeChecked,
...tseslint.configs.stylisticTypeChecked,
],
"files": ["**/*.ts"],
languageOptions: {
parser: tseslint.parser,
parserOptions: {
project: true,
},
},
"rules": {
"@typescript-eslint/no-unnecessary-type-assertion": 0,
"complexity": 0,
"jsdoc/no-undefined-types": [
1,
{"definedTypes": ["i64", "i32"]}
],
"jsdoc/require-jsdoc": 0,
"no-bitwise": 0,
},
});
export default jsConfigs.concat(asConfigs);