Skip to content

Commit c155ae0

Browse files
Move custom ESLint rules into internal package (#2498)
Based on facebook/react@30cce21#diff-a7adbbe27ccec89b583ac77c28b521ac
1 parent 157edcb commit c155ae0

File tree

6 files changed

+33
-1
lines changed

6 files changed

+33
-1
lines changed

.eslintrc.yml

+8
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,18 @@ env:
66
node: true
77
reportUnusedDisableDirectives: true
88
plugins:
9+
- graphql-internal
910
- flowtype
1011
- import
1112

1213
rules:
14+
##############################################################################
15+
# Internal rules located in 'resources/eslint-rules'.
16+
# See './resources/eslint-rules/README.md'
17+
##############################################################################
18+
19+
graphql-internal/no-dir-import: error
20+
1321
##############################################################################
1422
# `eslint-plugin-flowtype` rule list based on `v4.6.x`
1523
# https://github.com/gajus/eslint-plugin-flowtype#eslint-plugin-flowtype

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"test:ci": "yarn check --integrity && npm run prettier:check && npm run lint -- --no-cache && npm run check && npm run testonly:cover && npm run check:ts && npm run check:spelling && npm run build",
2929
"testonly": "mocha --full-trace src/**/__tests__/**/*-test.js",
3030
"testonly:cover": "nyc npm run testonly",
31-
"lint": "eslint --rulesdir './resources/eslint-rules' --rule 'no-dir-import: error' --cache --ext .js,.ts src resources",
31+
"lint": "eslint --cache --ext .js,.ts src resources",
3232
"benchmark": "node --noconcurrent_sweeping --expose-gc --predictable ./resources/benchmark.js",
3333
"prettier": "prettier --ignore-path .gitignore --write --list-different \"**/*.{js,ts,md,json,yml}\"",
3434
"prettier:check": "prettier --ignore-path .gitignore --check \"**/*.{js,ts,md,json,yml}\"",
@@ -56,6 +56,7 @@
5656
"dtslint": "3.3.0",
5757
"eslint": "6.8.0",
5858
"eslint-plugin-flowtype": "4.6.0",
59+
"eslint-plugin-graphql-internal": "link:./resources/eslint-rules",
5960
"eslint-plugin-import": "2.20.1",
6061
"flow-bin": "0.120.1",
6162
"mocha": "7.1.0",

resources/eslint-rules/README.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Custom ESLint Rules
2+
3+
This is a dummy npm package that allows us to treat it as an `eslint-plugin-graphql-internal`.
4+
It's not actually published, nor are the rules here useful for users of graphql.
5+
6+
**If you modify this rule, you must re-run `yarn` for it to take effect.**

resources/eslint-rules/index.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// @noflow
2+
3+
'use strict';
4+
5+
module.exports = {
6+
rules: {
7+
'no-dir-import': require('./no-dir-import'),
8+
},
9+
};

resources/eslint-rules/package.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "eslint-plugin-graphql-internal",
3+
"version": "0.0.0"
4+
}

yarn.lock

+4
Original file line numberDiff line numberDiff line change
@@ -1728,6 +1728,10 @@ [email protected]:
17281728
dependencies:
17291729
lodash "^4.17.15"
17301730

1731+
"eslint-plugin-graphql-internal@link:./resources/eslint-rules":
1732+
version "0.0.0"
1733+
uid ""
1734+
17311735
17321736
version "2.20.1"
17331737
resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.20.1.tgz#802423196dcb11d9ce8435a5fc02a6d3b46939b3"

0 commit comments

Comments
 (0)