Skip to content

Commit

Permalink
Move custom ESLint rules into internal package (#2498)
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov authored Apr 2, 2020
1 parent 157edcb commit c155ae0
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 1 deletion.
8 changes: 8 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,18 @@ env:
node: true
reportUnusedDisableDirectives: true
plugins:
- graphql-internal
- flowtype
- import

rules:
##############################################################################
# Internal rules located in 'resources/eslint-rules'.
# See './resources/eslint-rules/README.md'
##############################################################################

graphql-internal/no-dir-import: error

##############################################################################
# `eslint-plugin-flowtype` rule list based on `v4.6.x`
# https://github.com/gajus/eslint-plugin-flowtype#eslint-plugin-flowtype
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"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",
"testonly": "mocha --full-trace src/**/__tests__/**/*-test.js",
"testonly:cover": "nyc npm run testonly",
"lint": "eslint --rulesdir './resources/eslint-rules' --rule 'no-dir-import: error' --cache --ext .js,.ts src resources",
"lint": "eslint --cache --ext .js,.ts src resources",
"benchmark": "node --noconcurrent_sweeping --expose-gc --predictable ./resources/benchmark.js",
"prettier": "prettier --ignore-path .gitignore --write --list-different \"**/*.{js,ts,md,json,yml}\"",
"prettier:check": "prettier --ignore-path .gitignore --check \"**/*.{js,ts,md,json,yml}\"",
Expand Down Expand Up @@ -56,6 +56,7 @@
"dtslint": "3.3.0",
"eslint": "6.8.0",
"eslint-plugin-flowtype": "4.6.0",
"eslint-plugin-graphql-internal": "link:./resources/eslint-rules",
"eslint-plugin-import": "2.20.1",
"flow-bin": "0.120.1",
"mocha": "7.1.0",
Expand Down
6 changes: 6 additions & 0 deletions resources/eslint-rules/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Custom ESLint Rules

This is a dummy npm package that allows us to treat it as an `eslint-plugin-graphql-internal`.
It's not actually published, nor are the rules here useful for users of graphql.

**If you modify this rule, you must re-run `yarn` for it to take effect.**
9 changes: 9 additions & 0 deletions resources/eslint-rules/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// @noflow

'use strict';

module.exports = {
rules: {
'no-dir-import': require('./no-dir-import'),
},
};
4 changes: 4 additions & 0 deletions resources/eslint-rules/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "eslint-plugin-graphql-internal",
"version": "0.0.0"
}
4 changes: 4 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1728,6 +1728,10 @@ [email protected]:
dependencies:
lodash "^4.17.15"

"eslint-plugin-graphql-internal@link:./resources/eslint-rules":
version "0.0.0"
uid ""

[email protected]:
version "2.20.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.20.1.tgz#802423196dcb11d9ce8435a5fc02a6d3b46939b3"
Expand Down

0 comments on commit c155ae0

Please sign in to comment.