What rules do the community tend to override?
- Dominant language
- JavaScript
- Stars
- 148k
- Forks
- 26.6k
- PR merge metrics
- No merged PRs in 30d
Description
I'm opening this issue specifically to gather a list of the rules that those in the community feel are controversial or problematic, such that they override them, and most importantly, _why_.
This is not an invitation for "+1s" (those belong as reactions on individual posts), or an invitation to hear about everyone's subjective aesthetic preferences, nor is it an indication that any of these rules necessarily will - or will not - change. I'm simply hoping to primarily gather civil, well-reasoned explanations for why certain rules are overridden, disabled, etc.
Any comments mentioning spaces vs tabs, or semicolons, will be summarily deleted :-)
We're aware of the following:
- `react/jsx-filename-extension` - filed as #985. Why is it controversial? Some believe that `.js` files should be allowed to contain JSX. Others believe this is an app-level concern, and does not belong in a shared config (like "env" settings).
- ~~`import/no-extraneous-dependencies`: in test directories, for example, it needs to be overridden to the following (note: if/when eslint allows [glob-based config](https://github.com/eslint/eslint/issues/3611), then we'd set up some common test directory patterns so you wouldn't have to do this manually)~~ `eslint-config-airbnb` `v13.0.0` is now released, which resolves this.
``` js
"import/no-extraneous-dependencies": ["error", {
"devDependencies": true,
"optionalDependencies": false,
}],
```
- `camelcase`: when you're bound to the casing selected by APIs (https://github.com/airbnb/javascript/issues/1089#issuecomment-249396262, but Airbnb suffers from this too) This might also apply to `new-cap` and `no-underscore-dangle`.
- `no-param-reassign`: this happens frequently with a `reduce` where the entire operation is pure, but the reducer is not (ie, it mutates the accumulator, but the accumulator began as `{}` passed into the reducer). You can use `Object.assign({}, accumulator, changes)`, or `{ ...accumulator, ...changes }`, however. (per https://github.com/airbnb/javascript/issues/1089#issuecomment-249396262)
- `no-use-before-define`: some enjoy using hoisting to define helper methods at the bottom of the file. This guide discourages relying on hoisting; instead suggesting importing the helpers from another file when possible. (per https://github.com/airbnb/javascript/issues/1089#issuecomment-249396262)
- `no-mixed-operators` - specifically where it relates to arithmetic operators, where the PEMDAS rule applies. We're definitely considering loosening this rule as it applies to `*`, `/`, `+`, and `-`.
Any others? I'll update the original post with new examples as I'm made aware of them.
(Note: this does not cover env settings, like "browser", "node", "mocha", etc - these are app-level concerns, and as such, your `.eslintrc`, `tests/.eslintrc`, etc should be defining them)
Contributor guide
No contributing guide indexed for this repository
Research direction
Read the existing rule list and the 151-comment discussion before deciding whether there is a settled, well-reasoned addition. There are no files or tests named; done would mean updating the original issue with an agreed community override and its rationale, if the discussion reaches a clear conclusion.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- eslint, javascript
- Domain
- documentation, tooling
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100