-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy patheslint.config.cjs
More file actions
187 lines (178 loc) · 7.02 KB
/
Copy patheslint.config.cjs
File metadata and controls
187 lines (178 loc) · 7.02 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
180
181
182
183
184
185
186
187
"use strict";
var js = require("@eslint/js"),
globals = require("globals"),
jsdoc = require("eslint-plugin-jsdoc");
module.exports = [
{
ignores: [
".tmp/**",
"**/node_modules/**",
"bin/**",
"cli/lib/catharsis/**",
"cli/wrappers/**",
"coverage/**",
"dist/**",
"docs/**",
"examples/**",
"lib/deep-equal/**",
"lib/jsdoc-template/**",
"lib/prelude.js",
"lib/polyfill.js",
"lib/tape-adapter.js",
"sandbox/**",
"scripts/**",
"tests/**",
"!tests/data/rpc*.js",
"bench/generated/**"
]
},
{
linterOptions: {
reportUnusedDisableDirectives: false
}
},
js.configs.recommended,
{
files: [ "**/*.js" ],
plugins: {
jsdoc: jsdoc
},
languageOptions: {
ecmaVersion: 6,
sourceType: "commonjs",
globals: Object.assign(
{},
globals.node,
globals.browser,
{
ArrayBuffer: "writable",
Uint8Array: "writable",
Float32Array: "writable",
Float64Array: "writable",
define: "writable",
global: "writable",
XMLHttpRequest: "writable",
Promise: "writable"
}
)
},
rules: {
// Possible errors
"no-extra-parens": 1, // turned on as the daily lecture
"no-prototype-builtins": 1,
"no-restricted-syntax": [ 1,
{
selector: "AssignmentExpression[left.property.name='toString']",
message: "Define toString with Object.defineProperty to avoid the override mistake"
},
{
selector: "AssignmentExpression[left.object.property.name='prototype'][left.property.name='constructor']",
message: "Define prototype.constructor with a descriptor to avoid the override mistake"
},
{
selector: "AssignmentExpression[left.object.type='AssignmentExpression'][left.object.left.property.name='prototype'][left.property.name='constructor']",
message: "Define prototype.constructor with a descriptor to avoid the override mistake"
}
],
"no-template-curly-in-string": 1,
"no-unsafe-negation": 1,
"jsdoc/check-param-names": [ 1, { "allowExtraTrailingParamDocs": true } ],
"jsdoc/require-param": 1,
"jsdoc/require-param-type": 1,
"jsdoc/require-returns": 1,
"jsdoc/require-returns-type": 1,
// Best practices
"accessor-pairs": 1,
"array-callback-return": 1,
"block-scoped-var": 1,
"class-methods-use-this": 1,
"complexity": 0, // is sometimes necessary
"consistent-return": 1,
"curly": 0, // sometimes more braces than code
"default-case": 0, // just forces unnecessary code
"dot-location": 0, // looks nicer for chainables
"dot-notation": 0, // not compatible with some reserved properties
"eqeqeq": [ 1, "allow-null" ],
"guard-for-in": 1,
"no-alert": 1,
"no-caller": 1,
"no-cond-assign": 0,
"no-div-regex": 1,
"no-else-return": 1,
"no-empty-function": 1,
"no-eval": 1,
"no-extend-native": 1,
"no-extra-bind": 1,
"no-extra-label": 1,
"no-floating-decimal": 1,
"no-global-assign": 1,
"no-implicit-coercion": 1,
"no-implicit-globals": 1,
"no-implied-eval": 1,
"no-invalid-this": 1,
"no-iterator": 1,
"no-labels": 1,
"no-lone-blocks": 1,
"no-loop-func": 1,
"no-magic-numbers": 0, // it's actually fun to turn this on here
"no-new-func": 1,
"no-new-wrappers": 1,
"no-new": 1,
"no-octal-escape": 1,
"no-param-reassign": 0, // is necessary for varargs functions
"no-proto": 1,
"no-restricted-properties": 1,
"no-sequences": 1,
"no-script-url": 1,
"no-self-compare": 1,
"no-throw-literal": 1,
"no-unmodified-loop-condition": 1,
"no-unused-expressions": [ "error", { "allowShortCircuit": true } ],
"no-useless-call": 1,
"no-useless-concat": 1,
"no-useless-escape": 1,
"no-useless-return": 1,
"no-useless-assignment": 0,
"no-void": 1,
"no-with": 1,
"radix": 1,
"vars-on-top": 0, // makes code harder to read, not faster
"wrap-iife": 0, // used frequently where polyfilling
"yoda": 1,
// Strict mode
"strict": 1,
// Variables
"init-declarations": 0, // because no-undef-init is on and we actually want undefineds
"no-catch-shadow": 0, // no IE8 support anyway
"no-label-var": 1,
"no-restricted-globals": 1,
"no-return-assign": 0, // can make sense.
"no-shadow-restricted-names": 1,
"no-shadow": 0, // this is javascript. it has forEach and all that stuff.
"no-undef-init": 1,
"no-undef": 2,
"no-undefined": 0, // produces shorter code when testing against this
"no-use-before-define": 0, // can actually be used for a better overview, i.e. with module.exports
"no-unused-vars": [ 1, { "caughtErrors": "none" } ], // a warning is sufficient
// Node.js and CommonJS
"callback-return": 1,
"global-require": 0, // only way to resolve cyclic references
"handle-callback-err": 1,
"no-mixed-requires": 1,
"no-new-require": 1,
"no-path-concat": 1,
"no-process-env": 1,
"no-process-exit": 1,
"no-restricted-modules": 1,
"no-sync": 0, // for loadSync
// Stylistic Issues
"semi": 1, // maybe next time
"no-extra-semi": 1,
"quotes": 1, // useful for gzip
"no-trailing-spaces": 1,
"no-unneeded-ternary": 1,
"unicode-bom": [ 2, "never" ]
// ECMAScript 6 // maybe next time
}
}
];