Skip to content

Commit

Permalink
Use eslint-local-rules plugin
Browse files Browse the repository at this point in the history
This allows to avoid having errors in editors that
supports eslint

cf eslint/eslint#8769
  • Loading branch information
fredericgermain authored and loganfsmyth committed Sep 7, 2018
1 parent 1e1a89c commit 45c28fa
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"root": true,
"extends": "babel",
"plugins": ["prettier"],
"plugins": ["local-rules", "prettier"],
"rules": {
"curly": ["error", "multi-line"],
"prettier/prettier": "error",
Expand All @@ -14,8 +14,8 @@
{
"files": ["packages/*/src/**/*.js", "codemods/*/src/**/*.js"],
"rules": {
"no-undefined-identifier": "error",
"no-deprecated-clone": "error"
"local-rules/no-undefined-identifier": "error",
"local-rules/no-deprecated-clone": "error"
}
},
{
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ flow:
./node_modules/.bin/flow check --strip-root

lint:
./node_modules/.bin/eslint scripts $(SOURCES) '*.js' --format=codeframe --rulesdir="./scripts/eslint_rules"
./node_modules/.bin/eslint scripts $(SOURCES) '*.js' --format=codeframe

fix:
./node_modules/.bin/eslint scripts $(SOURCES) '*.js' --format=codeframe --fix --rulesdir="./scripts/eslint_rules"
./node_modules/.bin/eslint scripts $(SOURCES) '*.js' --format=codeframe --fix

clean: test-clean
rm -rf packages/babel-polyfill/browser*
Expand Down
9 changes: 9 additions & 0 deletions eslint-local-rules.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"use strict";

const noDeprecatedClone = require("./scripts/eslint_rules/no-deprecated-clone");
const noUndefinedIdentifier = require("./scripts/eslint_rules/no-undefined-identifier");

module.exports = {
"no-deprecated-clone": noDeprecatedClone,
"no-undefined-identifier": noUndefinedIdentifier,
};
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"eslint": "^5.3.0",
"eslint-config-babel": "^7.0.2",
"eslint-plugin-flowtype": "^2.50.0",
"eslint-plugin-local-rules": "0.1.0",
"eslint-plugin-prettier": "^2.6.2",
"flow-bin": "^0.80.0",
"graceful-fs": "^4.1.11",
Expand Down Expand Up @@ -77,7 +78,7 @@
},
"lint-staged": {
"*.js": [
"eslint --format=codeframe --rulesdir='./scripts/eslint_rules'"
"eslint --format=codeframe"
]
},
"jest": {
Expand Down
4 changes: 4 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3077,6 +3077,10 @@ eslint-plugin-flowtype@^2.50.0:
dependencies:
lodash "^4.17.10"

[email protected]:
version "0.1.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-local-rules/-/eslint-plugin-local-rules-0.1.0.tgz#6808bb4c1b9a432f6e54ff4dfb290073e1cdf700"

eslint-plugin-prettier@^2.6.2:
version "2.6.2"
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-2.6.2.tgz#71998c60aedfa2141f7bfcbf9d1c459bf98b4fad"
Expand Down

0 comments on commit 45c28fa

Please sign in to comment.