eslint 6.0.0-alpha.2 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +74 -0
- package/README.md +4 -11
- package/bin/eslint.js +4 -1
- package/lib/cli-engine/cascading-config-array-factory.js +15 -3
- package/lib/cli-engine/cli-engine.js +13 -3
- package/lib/cli-engine/config-array/config-array.js +1 -2
- package/lib/cli-engine/config-array/override-tester.js +11 -1
- package/lib/cli-engine/config-array-factory.js +7 -6
- package/lib/cli-engine/file-enumerator.js +5 -13
- package/lib/cli-engine/formatters/junit.js +14 -2
- package/lib/init/config-initializer.js +19 -9
- package/lib/linter/linter.js +2 -4
- package/lib/linter/node-event-generator.js +6 -4
- package/lib/rule-tester/rule-tester.js +41 -11
- package/lib/rules/arrow-body-style.js +2 -2
- package/lib/rules/arrow-parens.js +21 -0
- package/lib/rules/dot-location.js +21 -17
- package/lib/rules/max-len.js +7 -0
- package/lib/rules/multiline-comment-style.js +2 -1
- package/lib/rules/no-else-return.js +127 -0
- package/lib/rules/no-extra-parens.js +241 -17
- package/lib/rules/no-octal.js +1 -1
- package/lib/rules/no-param-reassign.js +12 -1
- package/lib/rules/no-restricted-imports.js +18 -14
- package/lib/rules/no-useless-escape.js +6 -1
- package/lib/rules/no-var.js +14 -1
- package/lib/rules/prefer-const.js +9 -3
- package/lib/rules/require-atomic-updates.js +63 -84
- package/lib/rules/sort-keys.js +11 -3
- package/lib/rules/utils/ast-utils.js +26 -1
- package/lib/rules/valid-typeof.js +1 -1
- package/lib/{cli-engine → shared}/naming.js +0 -0
- package/messages/extend-config-missing.txt +2 -0
- package/messages/print-config-with-directory-path.txt +2 -0
- package/package.json +24 -27
@@ -4,13 +4,6 @@
|
|
4
4
|
*/
|
5
5
|
"use strict";
|
6
6
|
|
7
|
-
//------------------------------------------------------------------------------
|
8
|
-
// Helpers
|
9
|
-
//------------------------------------------------------------------------------
|
10
|
-
|
11
|
-
const DEFAULT_MESSAGE_TEMPLATE = "'{{importSource}}' import is restricted from being used.";
|
12
|
-
const CUSTOM_MESSAGE_TEMPLATE = "'{{importSource}}' import is restricted from being used. {{customMessage}}";
|
13
|
-
|
14
7
|
//------------------------------------------------------------------------------
|
15
8
|
// Rule Definition
|
16
9
|
//------------------------------------------------------------------------------
|
@@ -62,6 +55,18 @@ module.exports = {
|
|
62
55
|
url: "https://eslint.org/docs/rules/no-restricted-imports"
|
63
56
|
},
|
64
57
|
|
58
|
+
messages: {
|
59
|
+
path: "'{{importSource}}' import is restricted from being used.",
|
60
|
+
// eslint-disable-next-line eslint-plugin/report-message-format
|
61
|
+
pathWithCustomMessage: "'{{importSource}}' import is restricted from being used. {{customMessage}}",
|
62
|
+
|
63
|
+
patterns: "'{{importSource}}' import is restricted from being used by a pattern.",
|
64
|
+
|
65
|
+
everything: "* import is invalid because '{{importNames}}' from '{{importSource}}' is restricted.",
|
66
|
+
// eslint-disable-next-line eslint-plugin/report-message-format
|
67
|
+
everythingWithCustomMessage: "* import is invalid because '{{importNames}}' from '{{importSource}}' is restricted. {{customMessage}}"
|
68
|
+
},
|
69
|
+
|
65
70
|
schema: {
|
66
71
|
anyOf: [
|
67
72
|
arrayOfStringsOrObjects,
|
@@ -127,13 +132,10 @@ module.exports = {
|
|
127
132
|
function reportPath(node) {
|
128
133
|
const importSource = node.source.value.trim();
|
129
134
|
const customMessage = restrictedPathMessages[importSource] && restrictedPathMessages[importSource].message;
|
130
|
-
const message = customMessage
|
131
|
-
? CUSTOM_MESSAGE_TEMPLATE
|
132
|
-
: DEFAULT_MESSAGE_TEMPLATE;
|
133
135
|
|
134
136
|
context.report({
|
135
137
|
node,
|
136
|
-
|
138
|
+
messageId: customMessage ? "pathWithCustomMessage" : "path",
|
137
139
|
data: {
|
138
140
|
importSource,
|
139
141
|
customMessage
|
@@ -152,7 +154,7 @@ module.exports = {
|
|
152
154
|
|
153
155
|
context.report({
|
154
156
|
node,
|
155
|
-
|
157
|
+
messageId: "patterns",
|
156
158
|
data: {
|
157
159
|
importSource
|
158
160
|
}
|
@@ -168,13 +170,15 @@ module.exports = {
|
|
168
170
|
*/
|
169
171
|
function reportPathForEverythingImported(importSource, node) {
|
170
172
|
const importNames = restrictedPathMessages[importSource].importNames;
|
173
|
+
const customMessage = restrictedPathMessages[importSource] && restrictedPathMessages[importSource].message;
|
171
174
|
|
172
175
|
context.report({
|
173
176
|
node,
|
174
|
-
|
177
|
+
messageId: customMessage ? "everythingWithCustomMessage" : "everything",
|
175
178
|
data: {
|
176
179
|
importSource,
|
177
|
-
importNames
|
180
|
+
importNames,
|
181
|
+
customMessage
|
178
182
|
}
|
179
183
|
});
|
180
184
|
}
|
@@ -102,9 +102,14 @@ module.exports = {
|
|
102
102
|
* @returns {void}
|
103
103
|
*/
|
104
104
|
function report(node, startOffset, character) {
|
105
|
+
const start = sourceCode.getLocFromIndex(sourceCode.getIndexFromLoc(node.loc.start) + startOffset);
|
106
|
+
|
105
107
|
context.report({
|
106
108
|
node,
|
107
|
-
loc:
|
109
|
+
loc: {
|
110
|
+
start,
|
111
|
+
end: { line: start.line, column: start.column + 1 }
|
112
|
+
},
|
108
113
|
message: "Unnecessary escape character: \\{{character}}.",
|
109
114
|
data: { character }
|
110
115
|
});
|
package/lib/rules/no-var.js
CHANGED
@@ -174,6 +174,17 @@ function hasReferenceInTDZ(node) {
|
|
174
174
|
};
|
175
175
|
}
|
176
176
|
|
177
|
+
/**
|
178
|
+
* Checks whether a given variable has name that is allowed for 'var' declarations,
|
179
|
+
* but disallowed for `let` declarations.
|
180
|
+
*
|
181
|
+
* @param {eslint-scope.Variable} variable The variable to check.
|
182
|
+
* @returns {boolean} `true` if the variable has a disallowed name.
|
183
|
+
*/
|
184
|
+
function hasNameDisallowedForLetDeclarations(variable) {
|
185
|
+
return variable.name === "let";
|
186
|
+
}
|
187
|
+
|
177
188
|
//------------------------------------------------------------------------------
|
178
189
|
// Rule Definition
|
179
190
|
//------------------------------------------------------------------------------
|
@@ -223,6 +234,7 @@ module.exports = {
|
|
223
234
|
* - A variable might be used before it is assigned within a loop.
|
224
235
|
* - A variable might be used in TDZ.
|
225
236
|
* - A variable is declared in statement position (e.g. a single-line `IfStatement`)
|
237
|
+
* - A variable has name that is disallowed for `let` declarations.
|
226
238
|
*
|
227
239
|
* ## A variable is declared on a SwitchCase node.
|
228
240
|
*
|
@@ -271,7 +283,8 @@ module.exports = {
|
|
271
283
|
node.declarations.some(hasSelfReferenceInTDZ) ||
|
272
284
|
variables.some(isGlobal) ||
|
273
285
|
variables.some(isRedeclared) ||
|
274
|
-
variables.some(isUsedFromOutsideOf(scopeNode))
|
286
|
+
variables.some(isUsedFromOutsideOf(scopeNode)) ||
|
287
|
+
variables.some(hasNameDisallowedForLetDeclarations)
|
275
288
|
) {
|
276
289
|
return false;
|
277
290
|
}
|
@@ -420,8 +420,9 @@ module.exports = {
|
|
420
420
|
|
421
421
|
let shouldFix = varDeclParent &&
|
422
422
|
|
423
|
-
// Don't do a fix unless the
|
424
|
-
(varDeclParent.parent.type === "ForInStatement" || varDeclParent.parent.type === "ForOfStatement" ||
|
423
|
+
// Don't do a fix unless all variables in the declarations are initialized (or it's in a for-in or for-of loop)
|
424
|
+
(varDeclParent.parent.type === "ForInStatement" || varDeclParent.parent.type === "ForOfStatement" ||
|
425
|
+
varDeclParent.declarations.every(declaration => declaration.init)) &&
|
425
426
|
|
426
427
|
/*
|
427
428
|
* If options.destructuring is "all", then this warning will not occur unless
|
@@ -450,7 +451,12 @@ module.exports = {
|
|
450
451
|
node,
|
451
452
|
messageId: "useConst",
|
452
453
|
data: node,
|
453
|
-
fix: shouldFix
|
454
|
+
fix: shouldFix
|
455
|
+
? fixer => fixer.replaceText(
|
456
|
+
sourceCode.getFirstToken(varDeclParent, t => t.value === varDeclParent.kind),
|
457
|
+
"const"
|
458
|
+
)
|
459
|
+
: null
|
454
460
|
});
|
455
461
|
});
|
456
462
|
}
|
@@ -24,12 +24,51 @@ function createReferenceMap(scope, outReferenceMap = new Map()) {
|
|
24
24
|
return outReferenceMap;
|
25
25
|
}
|
26
26
|
|
27
|
+
/**
|
28
|
+
* Get `reference.writeExpr` of a given reference.
|
29
|
+
* If it's the read reference of MemberExpression in LHS, returns RHS in order to address `a.b = await a`
|
30
|
+
* @param {escope.Reference} reference The reference to get.
|
31
|
+
* @returns {Expression|null} The `reference.writeExpr`.
|
32
|
+
*/
|
33
|
+
function getWriteExpr(reference) {
|
34
|
+
if (reference.writeExpr) {
|
35
|
+
return reference.writeExpr;
|
36
|
+
}
|
37
|
+
let node = reference.identifier;
|
38
|
+
|
39
|
+
while (node) {
|
40
|
+
const t = node.parent.type;
|
41
|
+
|
42
|
+
if (t === "AssignmentExpression" && node.parent.left === node) {
|
43
|
+
return node.parent.right;
|
44
|
+
}
|
45
|
+
if (t === "MemberExpression" && node.parent.object === node) {
|
46
|
+
node = node.parent;
|
47
|
+
continue;
|
48
|
+
}
|
49
|
+
|
50
|
+
break;
|
51
|
+
}
|
52
|
+
|
53
|
+
return null;
|
54
|
+
}
|
55
|
+
|
27
56
|
/**
|
28
57
|
* Checks if an expression is a variable that can only be observed within the given function.
|
29
|
-
* @param {
|
58
|
+
* @param {Variable|null} variable The variable to check
|
59
|
+
* @param {boolean} isMemberAccess If `true` then this is a member access.
|
30
60
|
* @returns {boolean} `true` if the variable is local to the given function, and is never referenced in a closure.
|
31
61
|
*/
|
32
|
-
function isLocalVariableWithoutEscape(variable) {
|
62
|
+
function isLocalVariableWithoutEscape(variable, isMemberAccess) {
|
63
|
+
if (!variable) {
|
64
|
+
return false; // A global variable which was not defined.
|
65
|
+
}
|
66
|
+
|
67
|
+
// If the reference is a property access and the variable is a parameter, it handles the variable is not local.
|
68
|
+
if (isMemberAccess && variable.defs.some(d => d.type === "Parameter")) {
|
69
|
+
return false;
|
70
|
+
}
|
71
|
+
|
33
72
|
const functionScope = variable.scope.variableScope;
|
34
73
|
|
35
74
|
return variable.references.every(reference =>
|
@@ -47,52 +86,49 @@ class SegmentInfo {
|
|
47
86
|
* @returns {void}
|
48
87
|
*/
|
49
88
|
initialize(segment) {
|
50
|
-
const
|
51
|
-
const
|
89
|
+
const outdatedReadVariableNames = new Set();
|
90
|
+
const freshReadVariableNames = new Set();
|
52
91
|
|
53
92
|
for (const prevSegment of segment.prevSegments) {
|
54
93
|
const info = this.info.get(prevSegment);
|
55
94
|
|
56
95
|
if (info) {
|
57
|
-
info.
|
58
|
-
info.
|
96
|
+
info.outdatedReadVariableNames.forEach(Set.prototype.add, outdatedReadVariableNames);
|
97
|
+
info.freshReadVariableNames.forEach(Set.prototype.add, freshReadVariableNames);
|
59
98
|
}
|
60
99
|
}
|
61
100
|
|
62
|
-
this.info.set(segment, {
|
101
|
+
this.info.set(segment, { outdatedReadVariableNames, freshReadVariableNames });
|
63
102
|
}
|
64
103
|
|
65
104
|
/**
|
66
105
|
* Mark a given variable as read on given segments.
|
67
106
|
* @param {PathSegment[]} segments The segments that it read the variable on.
|
68
|
-
* @param {
|
107
|
+
* @param {string} variableName The variable name to be read.
|
69
108
|
* @returns {void}
|
70
109
|
*/
|
71
|
-
markAsRead(segments,
|
110
|
+
markAsRead(segments, variableName) {
|
72
111
|
for (const segment of segments) {
|
73
112
|
const info = this.info.get(segment);
|
74
113
|
|
75
114
|
if (info) {
|
76
|
-
info.
|
115
|
+
info.freshReadVariableNames.add(variableName);
|
77
116
|
}
|
78
117
|
}
|
79
118
|
}
|
80
119
|
|
81
120
|
/**
|
82
|
-
* Move `
|
121
|
+
* Move `freshReadVariableNames` to `outdatedReadVariableNames`.
|
83
122
|
* @param {PathSegment[]} segments The segments to process.
|
84
123
|
* @returns {void}
|
85
124
|
*/
|
86
125
|
makeOutdated(segments) {
|
87
|
-
const vars = new Set();
|
88
|
-
|
89
126
|
for (const segment of segments) {
|
90
127
|
const info = this.info.get(segment);
|
91
128
|
|
92
129
|
if (info) {
|
93
|
-
info.
|
94
|
-
info.
|
95
|
-
info.freshReadVariables.clear();
|
130
|
+
info.freshReadVariableNames.forEach(Set.prototype.add, info.outdatedReadVariableNames);
|
131
|
+
info.freshReadVariableNames.clear();
|
96
132
|
}
|
97
133
|
}
|
98
134
|
}
|
@@ -100,14 +136,14 @@ class SegmentInfo {
|
|
100
136
|
/**
|
101
137
|
* Check if a given variable is outdated on the current segments.
|
102
138
|
* @param {PathSegment[]} segments The current segments.
|
103
|
-
* @param {
|
139
|
+
* @param {string} variableName The variable name to check.
|
104
140
|
* @returns {boolean} `true` if the variable is outdated on the segments.
|
105
141
|
*/
|
106
|
-
isOutdated(segments,
|
142
|
+
isOutdated(segments, variableName) {
|
107
143
|
for (const segment of segments) {
|
108
144
|
const info = this.info.get(segment);
|
109
145
|
|
110
|
-
if (info && info.
|
146
|
+
if (info && info.outdatedReadVariableNames.has(variableName)) {
|
111
147
|
return true;
|
112
148
|
}
|
113
149
|
}
|
@@ -140,69 +176,10 @@ module.exports = {
|
|
140
176
|
|
141
177
|
create(context) {
|
142
178
|
const sourceCode = context.getSourceCode();
|
143
|
-
const globalScope = context.getScope();
|
144
|
-
const dummyVariables = new Map();
|
145
179
|
const assignmentReferences = new Map();
|
146
180
|
const segmentInfo = new SegmentInfo();
|
147
181
|
let stack = null;
|
148
182
|
|
149
|
-
/**
|
150
|
-
* Get the variable of a given reference.
|
151
|
-
* If it's not defined, returns a dummy object.
|
152
|
-
* @param {escope.Reference} reference The reference to get.
|
153
|
-
* @returns {escope.Variable} The variable of the reference.
|
154
|
-
*/
|
155
|
-
function getVariable(reference) {
|
156
|
-
if (reference.resolved) {
|
157
|
-
return reference.resolved;
|
158
|
-
}
|
159
|
-
|
160
|
-
// Get or create a dummy.
|
161
|
-
const name = reference.identifier.name;
|
162
|
-
let variable = dummyVariables.get(name);
|
163
|
-
|
164
|
-
if (!variable) {
|
165
|
-
variable = {
|
166
|
-
name,
|
167
|
-
scope: globalScope,
|
168
|
-
references: []
|
169
|
-
};
|
170
|
-
dummyVariables.set(name, variable);
|
171
|
-
}
|
172
|
-
variable.references.push(reference);
|
173
|
-
|
174
|
-
return variable;
|
175
|
-
}
|
176
|
-
|
177
|
-
/**
|
178
|
-
* Get `reference.writeExpr` of a given reference.
|
179
|
-
* If it's the read reference of MemberExpression in LHS, returns RHS in order to address `a.b = await a`
|
180
|
-
* @param {escope.Reference} reference The reference to get.
|
181
|
-
* @returns {Expression|null} The `reference.writeExpr`.
|
182
|
-
*/
|
183
|
-
function getWriteExpr(reference) {
|
184
|
-
if (reference.writeExpr) {
|
185
|
-
return reference.writeExpr;
|
186
|
-
}
|
187
|
-
let node = reference.identifier;
|
188
|
-
|
189
|
-
while (node) {
|
190
|
-
const t = node.parent.type;
|
191
|
-
|
192
|
-
if (t === "AssignmentExpression" && node.parent.left === node) {
|
193
|
-
return node.parent.right;
|
194
|
-
}
|
195
|
-
if (t === "MemberExpression" && node.parent.object === node) {
|
196
|
-
node = node.parent;
|
197
|
-
continue;
|
198
|
-
}
|
199
|
-
|
200
|
-
break;
|
201
|
-
}
|
202
|
-
|
203
|
-
return null;
|
204
|
-
}
|
205
|
-
|
206
183
|
return {
|
207
184
|
onCodePathStart(codePath) {
|
208
185
|
const scope = context.getScope();
|
@@ -234,12 +211,14 @@ module.exports = {
|
|
234
211
|
if (!reference) {
|
235
212
|
return;
|
236
213
|
}
|
237
|
-
const
|
214
|
+
const name = reference.identifier.name;
|
215
|
+
const variable = reference.resolved;
|
238
216
|
const writeExpr = getWriteExpr(reference);
|
217
|
+
const isMemberAccess = reference.identifier.parent.type === "MemberExpression";
|
239
218
|
|
240
219
|
// Add a fresh read variable.
|
241
220
|
if (reference.isRead() && !(writeExpr && writeExpr.parent.operator === "=")) {
|
242
|
-
segmentInfo.markAsRead(codePath.currentSegments,
|
221
|
+
segmentInfo.markAsRead(codePath.currentSegments, name);
|
243
222
|
}
|
244
223
|
|
245
224
|
/*
|
@@ -248,7 +227,7 @@ module.exports = {
|
|
248
227
|
*/
|
249
228
|
if (writeExpr &&
|
250
229
|
writeExpr.parent.right === writeExpr && // ← exclude variable declarations.
|
251
|
-
!isLocalVariableWithoutEscape(variable)
|
230
|
+
!isLocalVariableWithoutEscape(variable, isMemberAccess)
|
252
231
|
) {
|
253
232
|
let refs = assignmentReferences.get(writeExpr);
|
254
233
|
|
@@ -263,7 +242,7 @@ module.exports = {
|
|
263
242
|
|
264
243
|
/*
|
265
244
|
* Verify assignments.
|
266
|
-
* If the reference exists in `
|
245
|
+
* If the reference exists in `outdatedReadVariableNames` list, report it.
|
267
246
|
*/
|
268
247
|
":expression:exit"(node) {
|
269
248
|
const { codePath, referenceMap } = stack;
|
@@ -285,9 +264,9 @@ module.exports = {
|
|
285
264
|
assignmentReferences.delete(node);
|
286
265
|
|
287
266
|
for (const reference of references) {
|
288
|
-
const
|
267
|
+
const name = reference.identifier.name;
|
289
268
|
|
290
|
-
if (segmentInfo.isOutdated(codePath.currentSegments,
|
269
|
+
if (segmentInfo.isOutdated(codePath.currentSegments, name)) {
|
291
270
|
context.report({
|
292
271
|
node: node.parent,
|
293
272
|
messageId: "nonAtomicUpdate",
|
package/lib/rules/sort-keys.js
CHANGED
@@ -96,6 +96,11 @@ module.exports = {
|
|
96
96
|
natural: {
|
97
97
|
type: "boolean",
|
98
98
|
default: false
|
99
|
+
},
|
100
|
+
minKeys: {
|
101
|
+
type: "integer",
|
102
|
+
minimum: 2,
|
103
|
+
default: 2
|
99
104
|
}
|
100
105
|
},
|
101
106
|
additionalProperties: false
|
@@ -110,6 +115,7 @@ module.exports = {
|
|
110
115
|
const options = context.options[1];
|
111
116
|
const insensitive = options && options.caseSensitive === false;
|
112
117
|
const natual = options && options.natural;
|
118
|
+
const minKeys = options && options.minKeys;
|
113
119
|
const isValidOrder = isValidOrders[
|
114
120
|
order + (insensitive ? "I" : "") + (natual ? "N" : "")
|
115
121
|
];
|
@@ -118,10 +124,11 @@ module.exports = {
|
|
118
124
|
let stack = null;
|
119
125
|
|
120
126
|
return {
|
121
|
-
ObjectExpression() {
|
127
|
+
ObjectExpression(node) {
|
122
128
|
stack = {
|
123
129
|
upper: stack,
|
124
|
-
prevName: null
|
130
|
+
prevName: null,
|
131
|
+
numKeys: node.properties.length
|
125
132
|
};
|
126
133
|
},
|
127
134
|
|
@@ -141,11 +148,12 @@ module.exports = {
|
|
141
148
|
}
|
142
149
|
|
143
150
|
const prevName = stack.prevName;
|
151
|
+
const numKeys = stack.numKeys;
|
144
152
|
const thisName = getPropertyName(node);
|
145
153
|
|
146
154
|
stack.prevName = thisName || prevName;
|
147
155
|
|
148
|
-
if (!prevName || !thisName) {
|
156
|
+
if (!prevName || !thisName || numKeys < minKeys) {
|
149
157
|
return;
|
150
158
|
}
|
151
159
|
|
@@ -37,6 +37,8 @@ const LINEBREAKS = new Set(["\r\n", "\r", "\n", "\u2028", "\u2029"]);
|
|
37
37
|
// A set of node types that can contain a list of statements
|
38
38
|
const STATEMENT_LIST_PARENTS = new Set(["Program", "BlockStatement", "SwitchCase"]);
|
39
39
|
|
40
|
+
const DECIMAL_INTEGER_PATTERN = /^(0|[1-9]\d*)$/u;
|
41
|
+
|
40
42
|
/**
|
41
43
|
* Checks reference if is non initializer and writable.
|
42
44
|
* @param {Reference} reference - A reference to check.
|
@@ -283,6 +285,16 @@ function isCommaToken(token) {
|
|
283
285
|
return token.value === "," && token.type === "Punctuator";
|
284
286
|
}
|
285
287
|
|
288
|
+
/**
|
289
|
+
* Checks if the given token is a dot token or not.
|
290
|
+
*
|
291
|
+
* @param {Token} token - The token to check.
|
292
|
+
* @returns {boolean} `true` if the token is a dot token.
|
293
|
+
*/
|
294
|
+
function isDotToken(token) {
|
295
|
+
return token.value === "." && token.type === "Punctuator";
|
296
|
+
}
|
297
|
+
|
286
298
|
/**
|
287
299
|
* Checks if the given token is a semicolon token or not.
|
288
300
|
*
|
@@ -462,12 +474,14 @@ module.exports = {
|
|
462
474
|
isColonToken,
|
463
475
|
isCommaToken,
|
464
476
|
isCommentToken,
|
477
|
+
isDotToken,
|
465
478
|
isKeywordToken,
|
466
479
|
isNotClosingBraceToken: negate(isClosingBraceToken),
|
467
480
|
isNotClosingBracketToken: negate(isClosingBracketToken),
|
468
481
|
isNotClosingParenToken: negate(isClosingParenToken),
|
469
482
|
isNotColonToken: negate(isColonToken),
|
470
483
|
isNotCommaToken: negate(isCommaToken),
|
484
|
+
isNotDotToken: negate(isDotToken),
|
471
485
|
isNotOpeningBraceToken: negate(isOpeningBraceToken),
|
472
486
|
isNotOpeningBracketToken: negate(isOpeningBracketToken),
|
473
487
|
isNotOpeningParenToken: negate(isOpeningParenToken),
|
@@ -988,7 +1002,18 @@ module.exports = {
|
|
988
1002
|
* '5' // false
|
989
1003
|
*/
|
990
1004
|
isDecimalInteger(node) {
|
991
|
-
return node.type === "Literal" && typeof node.value === "number" &&
|
1005
|
+
return node.type === "Literal" && typeof node.value === "number" &&
|
1006
|
+
DECIMAL_INTEGER_PATTERN.test(node.raw);
|
1007
|
+
},
|
1008
|
+
|
1009
|
+
/**
|
1010
|
+
* Determines whether this token is a decimal integer numeric token.
|
1011
|
+
* This is similar to isDecimalInteger(), but for tokens.
|
1012
|
+
* @param {Token} token - The token to check.
|
1013
|
+
* @returns {boolean} `true` if this token is a decimal integer.
|
1014
|
+
*/
|
1015
|
+
isDecimalIntegerNumericToken(token) {
|
1016
|
+
return token.type === "Numeric" && DECIMAL_INTEGER_PATTERN.test(token.value);
|
992
1017
|
},
|
993
1018
|
|
994
1019
|
/**
|
@@ -39,7 +39,7 @@ module.exports = {
|
|
39
39
|
|
40
40
|
create(context) {
|
41
41
|
|
42
|
-
const VALID_TYPES = ["symbol", "undefined", "object", "boolean", "number", "string", "function"],
|
42
|
+
const VALID_TYPES = ["symbol", "undefined", "object", "boolean", "number", "string", "function", "bigint"],
|
43
43
|
OPERATORS = ["==", "===", "!=", "!=="];
|
44
44
|
|
45
45
|
const requireStringLiterals = context.options[0] && context.options[0].requireStringLiterals;
|
File without changes
|
@@ -1,3 +1,5 @@
|
|
1
1
|
ESLint couldn't find the config "<%- configName %>" to extend from. Please check that the name of the config is correct.
|
2
2
|
|
3
|
+
The config "<%- configName %>" was referenced from the config file in "<%- importerName %>".
|
4
|
+
|
3
5
|
If you still have problems, please stop by https://gitter.im/eslint/eslint to chat with the team.
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "eslint",
|
3
|
-
"version": "6.
|
3
|
+
"version": "6.1.0",
|
4
4
|
"author": "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>",
|
5
5
|
"description": "An AST-based pattern checker for JavaScript.",
|
6
6
|
"bin": {
|
@@ -19,9 +19,7 @@
|
|
19
19
|
"docs": "node Makefile.js docs",
|
20
20
|
"gensite": "node Makefile.js gensite",
|
21
21
|
"webpack": "node Makefile.js webpack",
|
22
|
-
"perf": "node Makefile.js perf"
|
23
|
-
"profile": "beefy tests/bench/bench.js --open -- -t brfs -t ./tests/bench/xform-rules.js -r espree",
|
24
|
-
"coveralls": "cat ./coverage/lcov.info | coveralls"
|
22
|
+
"perf": "node Makefile.js perf"
|
25
23
|
},
|
26
24
|
"gitHooks": {
|
27
25
|
"pre-commit": "lint-staged"
|
@@ -51,49 +49,47 @@
|
|
51
49
|
"cross-spawn": "^6.0.5",
|
52
50
|
"debug": "^4.0.1",
|
53
51
|
"doctrine": "^3.0.0",
|
54
|
-
"eslint-scope": "^
|
52
|
+
"eslint-scope": "^5.0.0",
|
55
53
|
"eslint-utils": "^1.3.1",
|
56
54
|
"eslint-visitor-keys": "^1.0.0",
|
57
|
-
"espree": "^6.0.0
|
55
|
+
"espree": "^6.0.0",
|
58
56
|
"esquery": "^1.0.1",
|
59
57
|
"esutils": "^2.0.2",
|
60
58
|
"file-entry-cache": "^5.0.1",
|
61
59
|
"functional-red-black-tree": "^1.0.1",
|
62
|
-
"glob-parent": "^
|
60
|
+
"glob-parent": "^5.0.0",
|
63
61
|
"globals": "^11.7.0",
|
64
62
|
"ignore": "^4.0.6",
|
65
63
|
"import-fresh": "^3.0.0",
|
66
64
|
"imurmurhash": "^0.1.4",
|
67
|
-
"inquirer": "^6.
|
65
|
+
"inquirer": "^6.4.1",
|
68
66
|
"is-glob": "^4.0.0",
|
69
67
|
"js-yaml": "^3.13.1",
|
70
68
|
"json-stable-stringify-without-jsonify": "^1.0.1",
|
71
69
|
"levn": "^0.3.0",
|
72
|
-
"lodash": "^4.17.
|
70
|
+
"lodash": "^4.17.14",
|
73
71
|
"minimatch": "^3.0.4",
|
74
72
|
"mkdirp": "^0.5.1",
|
75
73
|
"natural-compare": "^1.4.0",
|
76
74
|
"optionator": "^0.8.2",
|
77
75
|
"progress": "^2.0.0",
|
78
76
|
"regexpp": "^2.0.1",
|
79
|
-
"semver": "^
|
80
|
-
"strip-ansi": "^
|
81
|
-
"strip-json-comments": "^
|
77
|
+
"semver": "^6.1.2",
|
78
|
+
"strip-ansi": "^5.2.0",
|
79
|
+
"strip-json-comments": "^3.0.1",
|
82
80
|
"table": "^5.2.3",
|
83
|
-
"text-table": "^0.2.0"
|
81
|
+
"text-table": "^0.2.0",
|
82
|
+
"v8-compile-cache": "^2.0.3"
|
84
83
|
},
|
85
84
|
"devDependencies": {
|
86
85
|
"@babel/core": "^7.4.3",
|
87
|
-
"@babel/polyfill": "^7.4.3",
|
88
86
|
"@babel/preset-env": "^7.4.3",
|
89
87
|
"acorn": "^6.1.1",
|
90
88
|
"babel-loader": "^8.0.5",
|
91
|
-
"beefy": "^2.1.8",
|
92
|
-
"brfs": "^2.0.2",
|
93
89
|
"chai": "^4.0.1",
|
94
90
|
"cheerio": "^0.22.0",
|
95
91
|
"common-tags": "^1.8.0",
|
96
|
-
"
|
92
|
+
"core-js": "^3.1.3",
|
97
93
|
"dateformat": "^3.0.3",
|
98
94
|
"ejs": "^2.6.1",
|
99
95
|
"eslint": "file:.",
|
@@ -114,21 +110,22 @@
|
|
114
110
|
"leche": "^2.2.3",
|
115
111
|
"lint-staged": "^8.1.5",
|
116
112
|
"load-perf": "^0.2.0",
|
117
|
-
"markdownlint": "^0.
|
118
|
-
"markdownlint-cli": "^0.
|
119
|
-
"metro-memory-fs": "^0.
|
113
|
+
"markdownlint": "^0.15.0",
|
114
|
+
"markdownlint-cli": "^0.17.0",
|
115
|
+
"metro-memory-fs": "^0.54.1",
|
120
116
|
"mocha": "^6.1.2",
|
117
|
+
"mocha-junit-reporter": "^1.23.0",
|
121
118
|
"npm-license": "^0.3.3",
|
122
|
-
"nyc": "^
|
119
|
+
"nyc": "^14.1.1",
|
123
120
|
"proxyquire": "^2.0.1",
|
124
|
-
"puppeteer": "^1.
|
125
|
-
"recast": "^0.
|
121
|
+
"puppeteer": "^1.18.0",
|
122
|
+
"recast": "^0.18.1",
|
123
|
+
"regenerator-runtime": "^0.13.2",
|
126
124
|
"shelljs": "^0.8.2",
|
127
|
-
"sinon": "^
|
125
|
+
"sinon": "^7.3.2",
|
128
126
|
"temp": "^0.9.0",
|
129
|
-
"
|
130
|
-
"webpack": "^
|
131
|
-
"webpack-cli": "^3.3.0",
|
127
|
+
"webpack": "^4.35.0",
|
128
|
+
"webpack-cli": "^3.3.5",
|
132
129
|
"yorkie": "^2.0.0"
|
133
130
|
},
|
134
131
|
"keywords": [
|