manovotny / eslint-config-get-off-my-lawn Goto Github PK
View Code? Open in Web Editor NEWA highly opinionated, sharable config of ESLint rules to produce beautiful, readable JavaScript.
License: MIT License
A highly opinionated, sharable config of ESLint rules to produce beautiful, readable JavaScript.
License: MIT License
Upon further research, it appears most configs have eslint
listed in devDependencies
and peerDependencies
rather than in dependencies
like get-off-my-lawn
has.
Examples:
While I have a strong disdane for divs they are still technically ok to use unlike the other deprecated elements in the list.
3:22 error 'assets-webpack-plugin' should be listed in the project's dependencies. Run 'npm i -S assets-webpack-plugin' to add it import/no-extraneous-dependencies
3:30 error "assets-webpack-plugin" is not found node/no-missing-require
React display names are not necessary for code to React, but they do aid in debugging issues.
In most cases, React can intuitively and automatically determine what the display name should be. But in other cases, namely in anonymous usages, it is not able to determine a display name, which makes debugging some React errors / warnings very, very difficult.
Warning: Each child in an array or iterator should have a unique "key" prop. Check the top-level render call using <div>.
The proposition is to relax the react/display-name
rule so it will only error on instances where a display name cannot be intuitively and automatically determined.
Recommendation is to change react/display-name
's ignoreTranspilerName
from true
to false
.
'react/display-name': [
'error',
{
ignoreTranspilerName: false
}
]
https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-autofocus.md
Though in talking with UX peoples, they have mixed responses. The decision to use autofocus
seems to be circumstantial.
This article probably describes how to best implement it.
http://www.brucelawson.co.uk/2009/the-accessibility-of-html-5-autofocus/
Essentially requires that shouldComponentUpdate
be implemented for React classes.
I can see definite benefit, but does it force premature optimization?
https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-optimization.md
Tip: Disallow known large imports from JavaScript projects with ESLint & the
no-restricted-imports
rule ~ great for helping teams avoid specific imports & recommending alternatives
๐ค
'jsx-a11y/label-has-for': [
'error',
{
required: {
every: [
'nesting'
]
}
}
]
prefer-named-capture-group seems like a good idea, but since it's an ES2018+ rule, it might be a bit early to adopt it.
Current Open Issue - Here
Wondering if that's enough to remove it from beta of v5 until it's fixed? Currently throwing unnecessary errors for Animated.Text
components.
I don't understand the benefit of this rule to be honest. My biggest issue is the eventHandlerPropPrefix
option. You might not have control over the naming of the functions that you are passed like router.goBack
when using React Router.
It's going to be deprecated, so let's remove it.
We needed to upgrade the eslint-plugin-import in order to fix #20, but I didn't want to add any new rules at this point in time.
At some point, we'll need to investigate what rules were added / deprecated between eslint-plugin-import 2.0.0
and 2.2.0
and do a breaking change.
As much as we want to include it, it's just too unstable right now and causes too many false positives right now.
With the exception of the issue in #101, everything appears to work correctly.
I'd be happy to make an attempt at this if desired.
Once higher versions of node become more prevalent.
https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/prefer-promises/fs.md
0:1 error Specify the rules you want to disable at line 1:0 unicorn/no-abusive-eslint-disable
1:0 error Unexpected unlimited 'eslint-disable' comment. Specify some rule names to disable eslint-comments/no-unlimited-disable
It's currently unhappy about import
and export
in projects that transpile.
We needed to upgrade eslint in order to fix #19, but I didn't want to add any new rules at this point in time.
At some point, we'll need to investigate what rules were added / deprecated between eslint 3.7.0
and 3.15.0
and do a breaking change.
Let's take max-statements
, for example... Say it's set to 10 lines. I then write this function that is 11 lines. Maybe it should be broken up into smaller, more easily consumable functions. Maybe the code makes more sense to stay together because it eloquently encapsulates a piece of functionality well. And that's the problem...
It depends.
Subjective rules like this are usually better left disabled and the kinds of things they try to prevent are better left to code reviews and conversations than hard and fast, black and white rules that arbitrarily force you to change the code or add a disable comment.
The following rules are in eslint-config-get-off-my-lawn
and should be considered for removal, or at the very least, changed to a warning.
complexity
max-depth
max-nested-callbacks
max-params
react/no-set-state
Eslint run times seem to be taking > 1 minute when eslint should be running in < 10 seconds.
import/no-dynamic-require seems to be too defensive. It's not common to dynamically require. It's rarely done maliciously, and more often than not, done intentionally. Seems silly to enforce something when it's purposefully ignored with a comment 99.5% of the time.
As much as we want to include it, it's just too unstable right now and causes too many false positives right now.
And using both will cause unnecessary updates.
Once higher versions of node become more prevalent.
https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/prefer-promises/dns.md
Can you add disallows unnecessary return await (no-return-await)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.