-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
eslint rules #90
Comments
here's the script yarn add eslint-config-standard eslint-config-airbnb-base const airbnbBases = [
'rules/best-practices',
'rules/errors',
'rules/node',
'rules/style',
'rules/variables',
'rules/es6',
'rules/imports',
'rules/strict',
]
// Allow filtering rules that are not enabled
const isEnabled = (val) => val !== 'off' && val[0] !== 'off'
const airbnbMap = Object.fromEntries(airbnbBases.map((extend) => [extend, require(`eslint-config-airbnb-base/${extend}`).rules]))
const airbnb = Object.values(airbnbMap).reduce((acc, v) => ({ ...acc, ...v }))
const airbnbStyleRules = airbnbMap['rules/style']
// console.log(airbnbStyleRules)
const airbnbEnabled = Object.fromEntries(Object.entries(airbnb).filter(([key, val]) => isEnabled(val)))
const standard = require('eslint-config-standard').rules
const standardEnabled = Object.fromEntries(Object.entries(standard).filter(([key, val]) => isEnabled(val)))
const diff1 = {}
Object.entries(airbnbEnabled).forEach(([key, val]) => {
// Exclude any style related rules
if (!standardEnabled[key] && !airbnbStyleRules[key]) diff1[key] = val
})
const diff2 = {}
Object.entries(standardEnabled).forEach(([key, val]) => {
// Exclude any style related rules
if (!airbnbEnabled[key] && !airbnbStyleRules[key]) diff2[key] = val
})
console.log('Rules in airbnb but not in standard', diff1)
console.log('Rules in standard but not in airbnb', diff2) |
If there are rules missing from standard that are particularly dear to you, shall we add them to to our configs on top of standardjs? Would it make sense to publish @transloadit/standard so that we can re-use this across repos? We have https://github.com/transloadit/monolib/ for easily publishing small functions into @transloadit, but like for this project a separate repo makes more sense - if at all. |
Different idea, we could also fork the airbnb standard as Transloadit's, then modify it until output results in practically no diff when we autofix our projects with it 🤔 |
Possible but then we woukld need to continuously rebase/merge our fork from origin which could cause conflicts all the time due to us having modified most rules (especially the style rules) |
I said fork but isn’t it possible to use their preset and then lay standard and your own rules on top in eslint? And could that bundling become our own preset? Then updating is a matter of updating npms inside our own style module? |
We can create our own config and extend eslint-airbnb-base and selectively disable rules from airbnb base. As for laying standard on top of airbnb, I'm not sure if that's the best idea as they are both very opinionated rulesets which change all the time. They have many of the same rules enabled but with different configs, and I don't know if in eslint one rule can conflict with another rule. So we can either:
|
Given how big airbnb was, i thought something like this may be the smaller task. If we can catch all errors that airbnb would, but keep the style that we have adopted in our projects, that would be a win. Can try for a few hours and if this turns into a spaceship, we can abort. (?) |
Continue discussion in https://github.com/transloadit/eslint-config-transloadit |
* extend eslint airbnb and refactor to respect rules * fix remaining lint issues * fix buggy tests * Add a test for totalBytes in uploadProgress (not yet implemented for isResumable=false) * Move out eslint #90 https://github.com/transloadit/eslint-config-transloadit * upgrade to newest eslint-config-transloadit version
I wrote a little script that compares rules from eslint-config-airbnb-base and eslint-config-standard.
Results
Rules in standard but not in airbnb
(Excluding style related rules)
Many of these are node related rules (airbnb does not include any node rules)
Regardless of which style we are using, we may want to include more of the [Node rules].(https://github.com/mysticatea/eslint-plugin-node)
Most of the others are already in airbnb but not yet enabled, until eslint v7 is required (airbnb currently supports eslint v5, v6 or v7 now)
Rules in airbnb but not in standard
(Excluding style related rules)
I tried to search for many of these rules in
standard
github issues, but I found no mentions.Other
I also noticed the rule
key-spacing
is causing big commit diffs if just one line is changed.node-sdk/.eslintrc.js
Line 20 in c2b7643
The text was updated successfully, but these errors were encountered: