Skip to content

Commit

Permalink
Merge pull request #11 from FuelRats/v2.2-adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
UncleClapton authored Jul 19, 2020
2 parents 4746022 + d5e9af7 commit 1461ec2
Show file tree
Hide file tree
Showing 22 changed files with 693 additions and 642 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
{ "directory": "./eslint-config", "changeProcessCWD": true },
{ "directory": "./eslint-config-react", "changeProcessCWD": true }
],
"editor.rulers": [180],
"git.ignoreLimitWarning": true
}
25 changes: 14 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-config-fuelrats",
"version": "2.1.0",
"version": "2.2.0",
"description": "Monorepo for @fuelrats/eslint-config[-react]!",
"private": true,
"license": "MIT",
Expand Down Expand Up @@ -37,7 +37,7 @@
"workspaces": [
"packages/*"
],
"main": "./packages/eslint-config-react/develop.js",
"main": "./packages/eslint-config/index.js",
"scripts": {
"eslint": "yarn workspaces run eslint .",
"release:base": "yarn workspace @fuelrats/eslint-config run release",
Expand All @@ -48,15 +48,18 @@
"release:canary": "yarn workspaces run release:canary",
"autoversion": "bash ./scripts/autoversion.sh"
},
"dependencies": {
"eslint-restricted-globals": "^0.2.0"
},
"devDependencies": {
"babel-eslint": "^10.0.3",
"eslint": "^6.8.0",
"eslint-plugin-babel": "^5.3.0",
"eslint-plugin-import": "^2.20.0",
"eslint-plugin-jsdoc": "^21.0.0",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.18.0",
"eslint-plugin-react-hooks": "^2.3.0",
"react": "^16.12.0"
"babel-eslint": "^10.1.0",
"eslint": "^7.5.0",
"eslint-plugin-babel": "^5.3.1",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jsdoc": "^30.0.0",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-react": "^7.20.3",
"eslint-plugin-react-hooks": "^4.0.8",
"react": "^16.13.1"
}
}
15 changes: 14 additions & 1 deletion packages/eslint-config-react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
# @fuelrats/eslint-config-react Changelog


## Unreleased
### Unreleased

#### Additions
* Enable `jsx-a11y/autocomplete-valid`


#### Changes
* set `parser` and `parserOptions` from main package so `eslint-config-react` can be used standalone.


#### Fixed
* resolved an issue where `indent` and `react/jsx-indent` conflict.





Expand Down
3 changes: 3 additions & 0 deletions packages/eslint-config-react/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ module.exports = {
'./rules/plugin-react-hooks',
'./rules/plugin-jsx-a11y',
].map(require.resolve),
parser: 'babel-eslint',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 2020,
sourceType: 'module',
},
settings: {
react: {
Expand Down
31 changes: 16 additions & 15 deletions packages/eslint-config-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fuelrats/eslint-config-react",
"version": "2.1.0",
"version": "2.2.0",
"description": "ESLint config for fuelrats react projects",
"license": "MIT",
"author": {
Expand Down Expand Up @@ -49,21 +49,22 @@
"release:canary": "yarn publish --tag canary --non-interactive"
},
"devDependencies": {
"babel-eslint": "^10.0.3",
"eslint": "^6.8.0",
"eslint-plugin-babel": "^5.3.0",
"eslint-plugin-import": "^2.20.0",
"eslint-plugin-jsdoc": "^21.0.0",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.18.0",
"eslint-plugin-react-hooks": "^2.3.0",
"react": "^16.12.0"
"babel-eslint": "^10.1.0",
"eslint": "^7.5.0",
"eslint-plugin-babel": "^5.3.1",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jsdoc": "^30.0.0",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-react": "^7.20.3",
"eslint-plugin-react-hooks": "^4.0.8",
"react": "^16.13.1"
},
"peerDependencies": {
"eslint": ">=6.7",
"eslint-plugin-jsx-a11y": ">=6.2",
"eslint-plugin-react": ">=7.18",
"eslint-plugin-react-hooks": ">=2.3",
"react": ">=16.8"
"babel-eslint": "^10",
"eslint": "^7.5",
"eslint-plugin-jsx-a11y": "^6.3",
"eslint-plugin-react": "^7.20",
"eslint-plugin-react-hooks": "^4.0.1",
"react": "^16.8"
}
}
6 changes: 6 additions & 0 deletions packages/eslint-config-react/rules/plugin-jsx-a11y.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ module.exports = {
'jsx-a11y/aria-unsupported-elements': ['error'],


/**
* Enforce that autocomplete attributes are used correctly.
*/
'jsx-a11y/autocomplete-valid': ['error'],


/**
* Enforce a clickable non-interactive element has at least one keyboard event listener.
*/
Expand Down
12 changes: 12 additions & 0 deletions packages/eslint-config-react/rules/plugin-next.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
plugins: [
'next',
],
rules: {
'next/no-css-tags': ['error'],

'next/no-html-link-for-pages': ['error'],

'next/no-sync-scripts': ['error'],
},
}
2 changes: 1 addition & 1 deletion packages/eslint-config-react/rules/plugin-react-jsx.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ module.exports = {
* Validate JSX indentation (fixable)
*/
'react/jsx-indent': ['error', 2, {
checkAttributes: true,
checkAttributes: false,
indentLogicalExpressions: true,
}],

Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config-react/rules/plugin-react.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ module.exports = {
/**
* Enforce where React component static properties should be positioned.
*/
'react/static-property-placement': ['off'],
'react/static-property-placement': ['error', 'static public field'],


/**
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-config/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = {
extends: './index.js',
rules: {
'no-magic-numbers': ['off'], // since defining a bunch of consts for lint rules is cumbersome
'quote-props': ['error', 'consistent-as-needed'], // since the majority of rules are in quotes with little outlyers;
'quote-props': ['error', 'consistent-as-needed'], // since the majority of rules are in quotes with little outliers;
'max-lines': ['off'], // We're not interested in breaking up rule files
}
},
}
23 changes: 22 additions & 1 deletion packages/eslint-config/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,29 @@
# @fuelrats/eslint-config Changelog


## Unreleased
### Unreleased

#### Additions
* Warn when a lint rule is being disabled that doesn't need to be.
* Enable ESLint v7 rules
* `default-case-last`
* `no-useless-backreference`
* `no-promise-executor-return`
* `no-unreachable-loop`
* Recognize the path alias `~` as an `internal` import in import ordering.


#### Changes
* Better and more consistent restricted syntax messages.
* Disallow explicit null checks via `no-restricted syntax` instead of abusing the combination of `eqeqeq`'s null option and `no-eq-null`
* add `inheritdoc` to certain `jsdoc` rule `exemptedBy` options so it's consistent with the default config
* make `import/order` case insensitive sort.
* Remove all node-specific rules since they are now deprecated.
* Improved settings for import plugin.
* Use `id-denylist` over `id-blacklist`
* Even though this rule is off we'd rather not have deprecated rule names :D
* Ensure our config is JSON serializable by replacing `Infinity` with `Number.MAX_SAFE_INTEGER`
* Enable `ignoreGlobals` for `camelcase` rule


### 2.1.0
Expand Down
25 changes: 14 additions & 11 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fuelrats/eslint-config",
"version": "2.1.0",
"version": "2.2.0",
"description": "ESLint config for fuelrats projects",
"license": "MIT",
"author": {
Expand Down Expand Up @@ -51,17 +51,20 @@
"eslint-restricted-globals": "^0.2.0"
},
"devDependencies": {
"babel-eslint": "^10.0.3",
"eslint": "^6.8.0",
"eslint-plugin-babel": "^5.3.0",
"eslint-plugin-import": "^2.20.0",
"eslint-plugin-jsdoc": "^21.0.0"
"babel-eslint": "^10.1.0",
"eslint": "^7.5.0",
"eslint-plugin-babel": "^5.3.1",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jsdoc": "^30.0.0",
"eslint-plugin-react": "^7.20.3",
"eslint-plugin-react-hooks": "^4.0.8",
"react": "^16.13.1"
},
"peerDependencies": {
"babel-eslint": ">=10",
"eslint": ">=6.7",
"eslint-plugin-babel": ">=5.3",
"eslint-plugin-import": ">=2.19",
"eslint-plugin-jsdoc": ">=21.0.0"
"babel-eslint": "^10",
"eslint": "^7.5",
"eslint-plugin-babel": "^5.3",
"eslint-plugin-import": "^2.21",
"eslint-plugin-jsdoc": "^28 || ^29 || ^30"
}
}
1 change: 0 additions & 1 deletion packages/eslint-config/purejs.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ module.exports = {
'./rules/bestpractices',
'./rules/errors',
'./rules/es6',
'./rules/node',
'./rules/style',
'./rules/variables',
'./rules/plugin-import',
Expand Down
8 changes: 7 additions & 1 deletion packages/eslint-config/rules/bestpractices.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ module.exports = {
}],


/**
* enforce default clauses in switch statements to be last
*/
'default-case-last': ['error'],


/**
* enforce default parameters to be last
*/
Expand All @@ -82,7 +88,7 @@ module.exports = {
* require the use of === and !==
*/
'eqeqeq': ['error', 'always', {
null: 'never',
null: 'always',
}],


Expand Down
20 changes: 20 additions & 0 deletions packages/eslint-config/rules/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ module.exports = {

/**
* disallow the use of debugger
*
* The impact of debugger slipping into production code HEAVILY outweighs it's benefit.
*/
'no-debugger': ['error'],

Expand Down Expand Up @@ -167,6 +169,12 @@ module.exports = {
'no-obj-calls': ['error'],


/**
* disallow returning values from Promise executor functions
*/
'no-promise-executor-return': ['error'],


/**
* disallow calling some Object.prototype methods directly on objects
*/
Expand Down Expand Up @@ -209,6 +217,12 @@ module.exports = {
'no-unreachable': ['error'],


/**
* disallow loops with a body that allows only one iteration
*/
'no-unreachable-loop': ['error'],


/**
* disallow control flow statements in finally blocks
*/
Expand All @@ -223,6 +237,12 @@ module.exports = {
}],


/**
* disallow useless backreferences in regular expressions
*/
'no-useless-backreference': ['error'],


/**
* disallow assignments that can lead to race conditions due to usage of await or yield
*
Expand Down
6 changes: 6 additions & 0 deletions packages/eslint-config/rules/es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ module.exports = {
'no-new-symbol': ['error'],


/**
* disallow specified names in exports
*/
'no-restricted-exports': ['off'],


/**
* disallow specified modules when loaded by import
*
Expand Down
Loading

0 comments on commit 1461ec2

Please sign in to comment.