id-match onlyDeclarations evaluates property assignment value (when it should not)
See original GitHub issueWhat version of ESLint are you using?
v2.8.0
What parser (default, Babel-ESLint, etc.) are you using?
babel-eslint
Please show your full configuration:
{
"rules": {
"id-match": [
2,
"(^[A-Za-z]+(?:[A-Z][a-z]*)*\\d*$)|(^[A-Z]+(_[A-Z]+)*(_\\d$)*$)|(^(_|\\$)$)",
{
"onlyDeclarations": true,
"properties": true
}
]
}
}
What did you do? Please include the actual source code causing the issue.
The subject code:
export default {
context: __dirname
};
What did you expect to happen?
I expected no linting error.
What actually happened? Please include the actual, raw output from ESLint.
I got a linting error:
β Line β Column β Type β Message β Rule ID β
ββββββββββββΌβββββββββββΌβββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββ’
β 25 β 14 β error β Identifier '__dirname' does not match the pattern β id-match β
β β β β '(^[A-Za-z]+(?:[A-Z][a-z]*)*\d*$)|(^[A-Z]+(_[A- β β
β β β β Z]+)*(_\d$)*$)|(^(_|\$)$)' β β
This is in relation to the following PR, https://github.com/eslint/eslint/pull/5631.
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
eslint-config-eslint | Yarn - Package Manager
Contains the ESLint configuration used for projects maintained by the ESLint team. Installation. You can install ESLint using npm: npm install eslint --save-dev....
Read more >declaration or statement expected. this '=' follows a block of ...
This '=' follows a block of statements, so if you intend to write a destructuring assignment, you might need to wrap the whole...
Read more >demo-outil-edition - node_modules - eslint - CHANGELOG.md
71adc66 Fix: avoid moving comments in implicit-arrow-linebreak (fixes ... ccd8ca9 Fix: Added property onlyDeclaration to id-match ruleΒ ...
Read more >Diff - 402e1b6e55e9041dfd1a93580e45e5c5dba1db55^!
For the purposes + of this License, Derivative Works shall not include ... +* ccd8ca9 Fix: Added property onlyDeclaration to id-match ruleΒ ...
Read more >https://wildtrack.org/wp-content/themes/nirvana-ch...
These values will be corrupted if the file is parsed with JavaScript. This file is not backwards-compatible with CodeKit 1 or 2.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think it should be keys only. If someone wanted to flag property values, too, they could turn off onlyDeclarations so it flags uses of identifiers that are not declared in the same script or module.
@kaicataldo care to review https://github.com/eslint/eslint/pull/5960 ?