-
Notifications
You must be signed in to change notification settings - Fork 1
📝 Enumerating eslint rules + package refactoring #1
📝 Enumerating eslint rules + package refactoring #1
Conversation
Ignoring debug files
Added support for commitizen, and validation for commit messages. Also added eslint as a dev dependency and peer dependency
Updated readme to be more expressive
Added all rules according to http://eslint.org/docs/rules/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our first PR 🚀 🥇
Nice job! :)
[![version](https://img.shields.io/npm/v/eslint-config-casumo.svg?style=flat-square)](https://www.npmjs.com/package/eslint-config-casumo) | ||
[![downloads](https://img.shields.io/npm/dm/eslint-config-casumo.svg?style=flat-square)](http://npm-stat.com/charts.html?package=eslint-config-casumo&from=2015-08-01) | ||
[![MIT License](https://img.shields.io/npm/l/eslint-config-casumo.svg?style=flat-square)](http://opensource.org/licenses/MIT) | ||
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, just wanted to recommend the commitizen-friendly badge, but see it's already there 😛
@@ -0,0 +1,77 @@ | |||
module.exports = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be nice to move these rule categories to a sub-directory, like /rules
browser: true, | ||
node: true | ||
}, | ||
rules: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we shouldn't include any environment setup in the rules themselves to make them more composable.
So like:
module.exports = {
rules: {
/* ... */
}
}
// NO_RULE 'require-await': 2, | ||
'vars-on-top': 2, | ||
'wrap-iife': 2 | ||
// 'yoda': 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This condition name yoda
still makes me laugh 😄
// 'accessor-pairs': 2, | ||
// 'array-callback-return': 2, | ||
// 'block-scoped-var': 2, | ||
// NO_RULE 'class-methods-use-this': 2, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really agree that we should add all the rules we don't use commented out. This makes it harder to read, and requires you to read the README to understand why are they commented out and to get what NO_RULE
means. Also we have to maintain the commented out rules as well as ESLint is updating.
I would rather just remove these rules for now (the ones we don't use) and add them back 1 by 1 by PRs when we feel the need for them. Then the conversation on that specific rule can be tracked down in the PR itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I the main reason I added this is for ease of use.
Pre this PR someone would have to cross reference the rules with the eslint site and copy and paste the config files in here (check if already exists and so on). My intention was to make it easy for someone to look at the category file (f.ex stylistic.js
) and get a fast clear picture of what are the possible rules they can enabled.
I will add the suggested workflow to follow in a contribution guide. That would give all the information to anyone who would like to contribute.
'./stylistic-issues.js', | ||
'./ecma-script-6.js' | ||
], | ||
rules: {}, | ||
globals: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think globals setup should go with environments, e.g. we have different globals needed for a test environment, for a browser and a node environment.
I don't know the right solution yet, I am just starting out from that I would like to use something like this: // tests/.eslintrc
{
"extends": [
"casumo",
"casumo/es6"
"casumo/mocha"
]
} // gulp/.eslintrc
{
"extends": [
"casumo",
"casumo/es6"
"casumo/node"
]
} So the environment specific stuff would be only in |
Had a change of heart and completely changed the direction. Now we have
So you could use it like this: By default it is es5 config {
"extends": "casumo"
} or {
"extends": "casumo/configurations/es5-browser"
} and in the gulp folder {
"extends": "casumo/configurations/es5-node"
} Also all rules are enabled (no commented rules), this is to prepare for the check for missing rules npm script |
44f9784
to
fb65164
Compare
@@ -0,0 +1,13 @@ | |||
module.exports = { | |||
extends: [ | |||
'../configurations/es5.js', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
./es5.js
would be enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haha I was following the pattern ../
to be consistent and easy on the eye 😄
this looks ugly 😛
extends: [
'./es5.js',
'../rules/mocha/on.js'
],
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh, ok, I thought it was accidental.
Yea, it's really easier to read that way and communicates the context. Agreed :)
@@ -0,0 +1,12 @@ | |||
module.exports = { | |||
extends: [ | |||
'../configurations/es5.js', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
./es5.js
would be enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as #1 (comment)
'../rules/eslint/strict-mode/on.js', | ||
'../rules/eslint/stylistic-issues/on.js', | ||
'../rules/eslint/variables/on.js', | ||
'../rules/eslint/deprecated/off.js' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we require in turned off rules here?
'../rules/eslint/deprecated/off.js'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To get a green light from eslint-find-rules
.
Currently it is throwing an error if the deprecated rules are not included.
Waiting on sarbbottam/eslint-find-rules#172 to be resolved and then we can safely remove them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh, ok, I see now. Can we add a comment or a todo to these, so they are describing why they are there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree :)
@@ -0,0 +1,18 @@ | |||
module.exports = { | |||
extends: [ | |||
'../configurations/es6-test.js' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'./es6-test.js'
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as #1 (comment)
}, | ||
globals: { | ||
expect: true, | ||
sandbox: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we add
describe: true,
it: true
as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
env mocha
does the trick :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aaa, cool I missed that :P 👍
'../rules/eslint/best-practices/on.js', | ||
'../rules/eslint/possible-errors/on.js', | ||
'../rules/eslint/ecma-script-6/off.js', | ||
'../rules/eslint/node-js-and-common-js/off.js', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any benefit of requiring in the turned off rules explicitly here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes because the idea is to always ship a full set of rules including on and off.
Like this we are explicitly ignoring ecma-script-6
and node-js-and-common-js
rules.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -0,0 +1,24 @@ | |||
module.exports = { | |||
extends: [ | |||
'../configurations/es6.js', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Relative path ./es6.js
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as #1 (comment)
@@ -0,0 +1,20 @@ | |||
module.exports = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need a composition file for the turned off rules?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be useful if someone wants to have only small number of rules turned on. Composing a config file with off.js
and their overrides
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm... I think it is descriptive enough if you only import / define the rules that you would like to enable. As no eslint rules are enabled by default, when would someone need to import this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As no eslint rules are enabled by default, when would someone need to import this?
If you do not import all the off rules then eslint-find-rules
would fail with the -u
option
One thing that I miss is the contribution guideline for it, as I don't really get the main differences between First I thought that the |
c80e1cc
to
eb439b5
Compare
eb439b5
to
72a3ab1
Compare
Updated contribution steps and added better explenation of the configuration structure
Version bump to 1.1.0
PR changes complete. Bumped the version to Waiting for 👍 so I will merge it in and publish the package. |
This is a non breaking change.
Followed the basic structure of eslint-config-walmart and migrated our rules.
What changed
commitizen
husky
andvalidate-commit-msg
)eslint
as a dependency and peer dependencynpm run commit
for those who don't havecommitizen
installed globallynpm run lint
self lintingnpm run find-new-eslint-rules
- checks for new (missing) rules inside for all the configurationsnpm run test
- lints and checks for rulesREADME
More things to look into
eslint-find-rules
Add travis support (maybe this shouldn't be part of this PR)Moved to issue https://github.com/Casumo/eslint-config-casumo/issues/2Add version bumping (maybe this shouldn't be part of this PR)Moved to issue https://github.com/Casumo/eslint-config-casumo/issues/3