twostoryrobot / eslint-config Goto Github PK
View Code? Open in Web Editor NEWeslint configuration for Two Story Robot
License: MIT License
eslint configuration for Two Story Robot
License: MIT License
create-react-app pins the eslint version as a direct dependency which results in issues when we install a different version to satisfy the peer dependency of this package. CRA says eslint should not be installed manually, but their installation is not hoisted for use by our package scripts.
We have a couple options:
eslint
a dependency of this packageeslint
version that CRA uses (not recommended by CRA and would be annoying to remember when Renovate tries to bump the version)There's a bug that breaks for ... of
loops: eslint/eslint#12117
If we update babel-eslint
is should solve this!
I propose that we use the prefer-const rule so we don't have to worry about let variables that aren't reassigned.
I think when the team started using let and const we mentioned that a good practice would be to always use const when the variable doesn't change. This wasn't formal or written down anywhere, so I think this rule will help.
Can I get a vote (πor π) from @TwoStoryRobot/devs and @TwoStoryRobot/students?
I've identified a few rules that exist which we already follow:
We could add these if we liked. Note: I haven't recently verified that some of these are not defaults, but pretty sure I got this list originally because they were not enabled for us.
AirBnB's eslint-config-airbnb package uses the eslint "extends" capability, which is cleaner (and more portable) than symlinking
I think with how often we use hooks now, it wouldn't be a bad idea to include eslint-plugin-react-hooks
in our eslint config.
I get the following errors after installing in a fresh CRA
/App.js
1:1 error Parsing error: 'import' and 'export' may appear only with 'sourceType: module'
This comment: eslint/eslint#6203 (comment) recommends setting sourceType: module
in the eslint config, but https://eslint.org/docs/user-guide/configuring#specifying-parser-options recommends using eslint-react-plugin.
Should we also be installingeslint-plugin-react
as a peer dependency and including it's config in the .eslintrc.js
file?
If you try to do a spread to get the rest of an object in destructuring you will get a Parsing error: Unexpected token ..
error
There is a fix: eslint/eslint#4052
Prettier changes strings that contain single quotes to use double quotes. This conflicts with eslint which strictly only allows single quotes. This prevents pre-commit checks from being successful. This could be fixed by using the "avoidEscape"
option for quotes.
eslint throws a bunch of indentation errors about indentations introduced by prettier.
Potential fix would be to add eslint-config-prettier which turns off all rules that might conflict with Prettier.
Two add to our config specs, change the following in index.js
:
- extends: ['eslint:recommended', 'plugin:jest/recommended']
+ extends: ['eslint:recommended', 'plugin:jest/recommended', 'prettier']
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.