scottnonnenberg / eslint-config-thehelp Goto Github PK
View Code? Open in Web Editor NEWThe way I write javascript.
License: MIT License
The way I write javascript.
License: MIT License
I like the no-plusplus
rule, but it is a bit annoying not being able to use it in for loops. The whole reason the rule exists isn't really valid in that case anyways. There is already an option to allow ++
only in the last part of loops.
Absolutely fantastic post at https://blog.scottnonnenberg.com/eslint-part-1-exploration/ Scott!
One thing that caught my eye was: https://blog.scottnonnenberg.com/eslint-part-1-exploration/#one-install
I wanted to make it a single install, so my configuration includes ESLint and all needed plugins. And this means, given ESLint plugin resolution rules, that you need npm version 3 and its flat node_modules directory structure. It seems like a reasonable tradeoff. peerDependencies are messy.
You are most certainly correct that peerDependencies
are messy. But a bigger issue is making sure to never ever allow folks to "rely" on npm
to flatten a dependency to any reasonable location.
Let's look at our dependencies here:
"dependencies": {
"eslint": "2.11.1",
"eslint-plugin-bdd": "2.1.0",
"eslint-plugin-chai-expect": "1.1.1",
"eslint-plugin-filenames": "1.0.0",
"eslint-plugin-immutable": "1.0.0",
"eslint-plugin-import": "1.8.0",
"eslint-plugin-jsx-a11y": "1.2.3",
"eslint-plugin-no-loops": "0.2.0",
"eslint-plugin-react": "5.1.1",
"eslint-plugin-security": "1.2.0",
"@scottnonnenberg/eslint-plugin-thehelp": "0.3.2"
},
So as a thought experiment, where can the [email protected]
script end up as a top level dependency? the answer is any of:
<root>/node_modules/.bin/eslint
<root>/node_modules/@scottnonnenberg/eslint-plugin-thehelp/node_modules/.bin/eslint
The other deps are likely reliable due to the way node require
resolution works. (Unless eslint requires them to be at <root>/node_modules/<right-here>
. If so, then you similarly can't guarantee that with the structure here -- you need root project deps to guarantee root location).
But here's the next thing with the extra non-eslint
dependencies: are all the uses of this package going to use all those plugins?
For instance, if I have a vanilla js / node project, I take the hit of unused plugins: eslint-plugin-react
, eslint-plugin-immutable
and other things I'm not using.
This is a long way of saying most of the projects I've seen and helped with either do use peerDependencies
, or instead document, but don't enforce deps (like https://github.com/walmartlabs/eslint-config-defaults)
Thoughts?
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.