Highlights
This release adds support for AST selectors. AST selectors can describe syntax patterns very precisely, using a similar syntax to CSS selectors. Selectors can be used to:
- simplify the implementation of custom rules.
- disallow particular syntax patterns in a codebase using the no-restricted-syntax rule.
For example, suppose you want to disallow calls to Mocha’s xdescribe
function in your codebase. Previously, it was not possible to do this without writing a custom rule. However, now you can configure the no-restricted-syntax rule with a selector:
{
"rules": {
"no-restricted-syntax": [
"error",
"CallExpression[callee.name='xdescribe']"
]
}
}
Selectors can give you a lot of control over specific patterns in your code, without needing to write a custom rule for each pattern.
For more details, see the selector documentation.
Features
Enhancements
- 23eca51 Update: Add allowTaggedTemplates to no-unused-expressions (fixes #7632) (#8253) (Kevin Partington)
- 7f8afe6 Update: no-extra-parens overlooked spread and superClass (fixes #8175) (#8209) (Toru Nagashima)
Bug Fixes
- 85f74ca Fix: broken code path of direct nested loops (fixes #8248) (#8274) (Toru Nagashima)
- a61c359 Fix: Ignore hidden folders when resolving globs (fixes #8259) (#8270) (Ian VanSchooten)
- 0c0fc31 Fix: false positive of no-extra-parens about spread and sequense (#8275) (Toru Nagashima)
- 47c3171 Fix: typo in console.error (#8258) (Jan Peer Stöcklmair)
- 13eead9 Fix: sort-vars crash on mixed destructuring declarations (#8245) (Teddy Katz)
- 133f489 Fix: func-name-matching crash on destructuring assignment to functions (#8247) (Teddy Katz)
- a34b9c4 Fix: func-name-matching crash on non-string literal computed keys (#8246) (Teddy Katz)
- 5b5c236 Fix: wrong comment when module not found in config (fixes #8192) (#8196) (alberto)
Documentation
- e104973 Docs: remove self-reference in no-restricted-syntax docs (#8277) (Vitor Balocco)
- 7276e6d Docs: remove unneeded semicolons in arrow-parens.md (#8249) (Dmitry Gershun)
- df12137 Docs: fix typos (#8235) (Gyandeep Singh)
- ce6ff56 Docs: set recommended true for no-global-assign (fixes #8215) (#8218) (BinYi LIU)
Dependency Upgrades
- f9ede3f Upgrade: doctrine to 2.0.0 (#8269) (alberto)
- 8c40a25 Upgrade: update concat-stream to 1.5.2 (#8228) (Samuel)
- 149c055 Upgrade: mock-fs to v4.2.0 (fixes #8194) (#8243) (Teddy Katz)
Build Related
Chores
- 6f05546 Chore: convert StubModuleResolver in config tests to ES6 class (#8265) (Teddy Katz)
- 63ca0c5 Chore: use precalculated counts in stylish formatter (#8251) (alberto)
- e74ed6d Chore: convert Traverser to ES6 class (refs #7849) (#8232) (Teddy Katz)
- b5e9788 Chore: rename no-extra-parens methods (#8225) (Vitor Balocco)