Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breaking: upgrade espree and support new class features (refs #14343) #14591

Merged
merged 68 commits into from Aug 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
b2cf867
update package.json (temporary)
mysticatea May 11, 2021
4902005
update ast-utils
mysticatea May 11, 2021
dbcec9d
update camelcase
mysticatea May 11, 2021
0934d6d
update accessor-pairs (test-only)
mysticatea May 11, 2021
11dfa74
update class-methods-use-this
mysticatea May 11, 2021
dadc75d
update computed-property-spacing
mysticatea May 11, 2021
1c7a13f
update dot-location (test-only)
mysticatea May 11, 2021
8368b9c
update dot-notation (test-only)
mysticatea May 11, 2021
649aeaa
update func-names
mysticatea May 11, 2021
b65f58a
update getter-return (test-only)
mysticatea May 11, 2021
7c1e48f
update grouped-accessor-pairs (test-only)
mysticatea May 11, 2021
fa6e62e
update indent
mysticatea May 11, 2021
ddd4bd8
update keyword-spacing
mysticatea May 12, 2021
17a59e3
update lines-between-class-members (test-only)
mysticatea May 12, 2021
41e05ee
update no-dupe-class-members
mysticatea May 12, 2021
7321584
update no-extra-semi
mysticatea May 12, 2021
af6099a
update no-invalid-this
mysticatea May 13, 2021
ea1ebb1
update no-multi-assign
mysticatea May 13, 2021
17ef4c8
update no-proto (test-only)
mysticatea May 13, 2021
1727398
update no-prototype-builtins (test-only)
mysticatea May 13, 2021
4c32c5c
update no-restricted-properties (test-only)
mysticatea May 13, 2021
f861b39
update no-self-assign
mysticatea May 13, 2021
7235b10
update no-self-compare (test-only)
mysticatea May 13, 2021
685852c
update no-setter-return
mysticatea May 13, 2021
2c6b194
update no-shadow (test-only)
mysticatea May 13, 2021
b77b428
update no-this-before-super (test-only)
mysticatea May 13, 2021
2b693ec
update no-throw-literal (test-only)
mysticatea May 13, 2021
c605eac
update no-undef-init
mysticatea May 13, 2021
cf9290b
update no-underscore-dangle
mysticatea May 13, 2021
1fb614e
update no-unexpected-multiline (test-only)
mysticatea May 13, 2021
da55c3a
update no-unreachable
mysticatea May 13, 2021
2995d40
update no-useless-call (test-only)
mysticatea May 13, 2021
5844aed
update no-useless-computed-key
mysticatea May 13, 2021
4c13911
update no-eval
mysticatea May 14, 2021
96adc98
update operator-assignment (test-only)
mysticatea May 14, 2021
08c03fe
update operator-linebreak
mysticatea May 14, 2021
1db8674
update padded-blocks (test-only)
mysticatea May 14, 2021
5013ff5
update prefer-exponentiation-operator
mysticatea May 14, 2021
41005b2
update prefer-numeric-literals (test-only)
mysticatea May 16, 2021
e8e8d5c
update prefer-object-spread (test-only)
mysticatea May 16, 2021
6faba6c
update prefer-promise-reject-errors (test-only)
mysticatea May 16, 2021
39a768a
update prefer-regex-literals (test-only)
mysticatea May 16, 2021
5cd34c6
update prefer-spread (test-only)
mysticatea May 16, 2021
7814ab2
update quotes
mysticatea May 16, 2021
6eceb08
update radix (test-only)
mysticatea May 16, 2021
81c4387
update require-atomic-updates (test-only)
mysticatea May 16, 2021
94b77df
update require-unicode-regexp (test-only)
mysticatea May 16, 2021
39fda57
update semi-spacing
mysticatea May 16, 2021
d2fcec2
update semi-style
mysticatea May 16, 2021
71a8711
update semi
mysticatea May 16, 2021
d8a7424
update space-infix-ops
mysticatea May 16, 2021
dc38e3e
update strict (test-only)
mysticatea May 16, 2021
0be8430
add more tests to no-unexpected-multiline
mysticatea May 16, 2021
2c258d8
fix some tests for 7345747708cbea25f00aee01b2f5fc033e53f19c
mysticatea May 16, 2021
c7bf095
fix no-invalid-this
mysticatea May 16, 2021
24d2309
fix no-eval
mysticatea May 16, 2021
d11a191
Update eslint-scope
nzakas Jul 23, 2021
ffbc00b
Upgrade Espree
nzakas Jul 23, 2021
a864b08
Fix eslint-scope references to parser test
nzakas Jul 23, 2021
1dbcca0
Fix: id-denylist
nzakas Jul 27, 2021
c9ab746
Update comments
nzakas Jul 27, 2021
c6f69e4
Fix: id-match
nzakas Jul 27, 2021
193c032
Fix: id-length
nzakas Jul 27, 2021
a8dad97
Update: id-denylist for class fields
nzakas Jul 27, 2021
dfde007
Update: id-length
nzakas Jul 28, 2021
b0d0db3
Update: id-denylist code and docs
nzakas Jul 28, 2021
aaaf5aa
Docs: id-denylist
nzakas Jul 28, 2021
fbe828b
Update: id-match
nzakas Jul 28, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
34 changes: 34 additions & 0 deletions docs/rules/id-denylist.md
Expand Up @@ -13,6 +13,8 @@ This rule will catch disallowed identifiers that are:
- variable declarations
- function declarations
- object properties assigned to during object creation
- class fields
- class methods

It will not catch disallowed identifiers that are:

Expand Down Expand Up @@ -49,6 +51,22 @@ element.callback = function() {
var itemSet = {
data: [...]
};

class Foo {
data = [];
}

class Foo {
#data = [];
}

class Foo {
callback( {);
}

class Foo {
#callback( {);
}
```

Examples of **correct** code for this rule with sample `"data", "callback"` restricted identifiers:
Expand All @@ -75,6 +93,22 @@ callback(); // all function calls are ignored
foo.callback(); // all function calls are ignored

foo.data; // all property names that are not assignments are ignored

class Foo {
items = [];
}

class Foo {
#items = [];
}

class Foo {
method( {);
}

class Foo {
#method( {);
}
```

## When Not To Use It
Expand Down
6 changes: 6 additions & 0 deletions docs/rules/id-length.md
Expand Up @@ -30,6 +30,9 @@ var myObj = { a: 1 };
(a) => { a * a };
class x { }
class Foo { x() {} }
class Foo { #x() {} }
class Foo { x = 1 }
class Foo { #x = 1 }
function foo(...x) { }
function foo([x]) { }
var [x] = arr;
Expand Down Expand Up @@ -61,6 +64,9 @@ var myObj = { apple: 1 };
function foo(num = 0) { }
class MyClass { }
class Foo { method() {} }
class Foo { #method() {} }
class Foo { field = 1 }
class Foo { #field = 1 }
function foo(...args) { }
function foo([longName]) { }
var { prop } = {};
Expand Down
44 changes: 42 additions & 2 deletions docs/rules/id-match.md
Expand Up @@ -35,9 +35,20 @@ var MY_FAVORITE_COLOR = "#112C85";
function do_something() {
// ...
}

obj.do_something = function() {
// ...
};

class My_Class {}

class myClass {
do_something() {}
}

class myClass {
#do_something() {}
}
```

Examples of **correct** code for this rule with the `"^[a-z]+([A-Z][a-z]+)*$"` option:
Expand All @@ -52,13 +63,26 @@ do_something();
var obj = {
my_pref: 1
};

class myClass {}

class myClass {
doSomething() {}
}

class myClass {
#doSomething() {}
}
```

This rule has an object option:

* `"properties": true` requires object properties to match the specified regular expression
* `"properties": false` (default) does not check object properties
* `"properties": true` requires object literal properties and member expression assignment properties to match the specified regular expression
* `"classFields": false` (default) does not class field names
* `"classFields": true` requires class field names to match the specified regular expression
* `"onlyDeclarations": false` (default) requires all variable names to match the specified regular expression
* `"onlyDeclarations": true` requires only `var`, `function`, and `class` declarations to match the specified regular expression
* `"onlyDeclarations": false` requires all variable names to match the specified regular expression
* `"ignoreDestructuring": false` (default) enforces `id-match` for destructured identifiers
* `"ignoreDestructuring": true` does not check destructured identifiers

Expand All @@ -74,6 +98,22 @@ var obj = {
};
```

### classFields

Examples of **incorrect** code for this rule with the `"^[a-z]+([A-Z][a-z]+)*$", { "classFields": true }` options:

```js
/*eslint id-match: ["error", "^[a-z]+([A-Z][a-z]+)*$", { "properties": true }]*/

class myClass {
my_pref = 1;
}

class myClass {
#my_pref = 1;
}
```

### onlyDeclarations

Examples of **correct** code for this rule with the `"^[a-z]+([A-Z][a-z]+)*$", { "onlyDeclarations": true }` options:
Expand Down