Skip to content

Commit

Permalink
Merge branch 'master' into ts-extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
benjie committed Jun 3, 2020
2 parents 1135020 + 056a6e4 commit 4881a33
Show file tree
Hide file tree
Showing 187 changed files with 20,755 additions and 8,979 deletions.
6 changes: 5 additions & 1 deletion .babelrc.json
Expand Up @@ -6,7 +6,11 @@
],
"overrides": [
{
"exclude": ["**/__tests__/**/*", "**/__fixtures__/**/*"],
"exclude": [
"src/__testUtils__/**/*",
"**/__tests__/**/*",
"**/__fixtures__/**/*"
],
"presets": ["@babel/preset-env"],
"plugins": [
["@babel/plugin-transform-classes", { "loose": true }],
Expand Down
149 changes: 121 additions & 28 deletions .eslintrc.yml
Expand Up @@ -6,12 +6,22 @@ env:
node: true
reportUnusedDisableDirectives: true
plugins:
- graphql-internal
- flowtype
- node
- istanbul
- import

rules:
##############################################################################
# `eslint-plugin-flowtype` rule list based on `v4.6.x`
# 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 `v5.1.x`
# https://github.com/gajus/eslint-plugin-flowtype#eslint-plugin-flowtype
##############################################################################

Expand Down Expand Up @@ -58,6 +68,66 @@ rules:
flowtype/space-before-type-colon: off
flowtype/union-intersection-spacing: off

##############################################################################
# `eslint-plugin-istanbul` rule list based on `v0.1.1`
# https://github.com/istanbuljs/eslint-plugin-istanbul#rules
##############################################################################

istanbul/no-ignore-file: error
istanbul/prefer-ignore-reason: error

##############################################################################
# `eslint-plugin-node` rule list based on `v11.1.x`
##############################################################################

# Possible Errors
# https://github.com/mysticatea/eslint-plugin-node#possible-errors

node/handle-callback-err: [error, error]
node/no-callback-literal: error
node/no-exports-assign: error
node/no-extraneous-import: error
node/no-extraneous-require: error
node/no-missing-import: error
node/no-missing-require: error
node/no-new-require: error
node/no-path-concat: error
node/no-process-exit: off
node/no-unpublished-bin: error
node/no-unpublished-import: error
node/no-unpublished-require: error
node/no-unsupported-features/es-builtins: error
node/no-unsupported-features/es-syntax: off # TODO enable
node/no-unsupported-features/node-builtins: off # TODO enable
node/process-exit-as-throw: error
node/shebang: error

# Best Practices
# https://github.com/mysticatea/eslint-plugin-node#best-practices
node/no-deprecated-api: error

# Stylistic Issues
# https://github.com/mysticatea/eslint-plugin-node#stylistic-issues

node/callback-return: error
node/exports-style: off # TODO consider
node/file-extension-in-import: off # TODO consider
node/global-require: error
node/no-mixed-requires: error
node/no-process-env: off
node/no-restricted-import: off
node/no-restricted-require: off
node/no-sync: error
node/prefer-global/buffer: error
node/prefer-global/console: error
node/prefer-global/process: error
node/prefer-global/text-decoder: error
node/prefer-global/text-encoder: error
node/prefer-global/url-search-params: error
node/prefer-global/url: error
node/prefer-promises/dns: off
node/prefer-promises/fs: off

##############################################################################
# `eslint-plugin-import` rule list based on `v2.20.x`
##############################################################################
Expand All @@ -68,7 +138,12 @@ rules:
import/named: error
import/default: error
import/namespace: error
import/no-restricted-paths: off
import/no-restricted-paths:
- error
- basePath: './'
zones:
- { target: './src', from: 'src/__testUtils__' }
- { target: './src', from: 'src/__fixtures__' }
import/no-absolute-path: error
import/no-dynamic-require: error
import/no-internal-modules: off
Expand Down Expand Up @@ -115,7 +190,7 @@ rules:
import/dynamic-import-chunkname: off

##############################################################################
# ESLint builtin rules list based on `v6.8.x`
# ESLint builtin rules list based on `v7.1.x`
##############################################################################

# Possible Errors
Expand Down Expand Up @@ -144,6 +219,7 @@ rules:
no-inner-declarations: [error, both]
no-invalid-regexp: error
no-irregular-whitespace: error
no-loss-of-precision: error
no-misleading-character-class: error
no-obj-calls: error
no-prototype-builtins: error
Expand All @@ -154,6 +230,7 @@ rules:
no-unreachable: error
no-unsafe-finally: error
no-unsafe-negation: error
no-useless-backreference: error
require-atomic-updates: error
use-isnan: error
valid-typeof: error
Expand All @@ -169,8 +246,9 @@ rules:
consistent-return: off
curly: error
default-case: off
default-case-last: error
default-param-last: error
dot-notation: off
dot-notation: error
eqeqeq: [error, smart]
grouped-accessor-pairs: error
guard-for-in: error
Expand All @@ -193,7 +271,7 @@ rules:
no-implicit-coercion: error
no-implicit-globals: off
no-implied-eval: error
no-invalid-this: off
no-invalid-this: error
no-iterator: error
no-labels: error
no-lone-blocks: error
Expand Down Expand Up @@ -256,21 +334,6 @@ rules:
no-unused-vars: [error, { vars: all, args: all, argsIgnorePattern: '^_' }]
no-use-before-define: off

# Node.js and CommonJS
# https://eslint.org/docs/rules/#nodejs-and-commonjs

callback-return: error
global-require: error
handle-callback-err: [error, error]
no-buffer-constructor: error
no-mixed-requires: error
no-new-require: error
no-path-concat: error
no-process-env: off
no-process-exit: off
no-restricted-modules: off
no-sync: error

# Stylistic Issues
# https://eslint.org/docs/rules/#stylistic-issues

Expand Down Expand Up @@ -336,6 +399,7 @@ rules:
no-dupe-class-members: error
no-duplicate-imports: error
no-new-symbol: error
no-restricted-exports: off
no-restricted-imports: off
no-this-before-super: error
no-useless-computed-key: error
Expand Down Expand Up @@ -429,27 +493,34 @@ overrides:
- '@typescript-eslint'
extends:
- plugin:import/typescript
settings:
node:
tryExtensions: ['.js', '.json', '.node', '.ts', '.d.ts']
rules:
flowtype/require-valid-file-annotation: off
flowtype/no-types-missing-file-annotation: off

##########################################################################
# `@typescript-eslint/eslint-plugin` rule list based on `v2.21.x`
# `@typescript-eslint/eslint-plugin` rule list based on `v3.0.x`
##########################################################################

# Supported Rules
# https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin#supported-rules
'@typescript-eslint/adjacent-overload-signatures': error
'@typescript-eslint/array-type': [error, { default: generic }]
'@typescript-eslint/await-thenable': error
'@typescript-eslint/ban-ts-comment': error
'@typescript-eslint/ban-ts-comment':
[error, { 'ts-expect-error': 'allow-with-description' }]
'@typescript-eslint/ban-types': error
'@typescript-eslint/class-literal-property-style': off
'@typescript-eslint/consistent-type-assertions':
[error, { assertionStyle: as, objectLiteralTypeAssertions: never }]
'@typescript-eslint/consistent-type-definitions': off # TODO consider
'@typescript-eslint/explicit-function-return-type': off # TODO consider
'@typescript-eslint/explicit-member-accessibility': off # TODO consider
'@typescript-eslint/explicit-module-boundary-types': off # TODO consider
'@typescript-eslint/member-ordering': off # TODO consider
'@typescript-eslint/method-signature-style': error
'@typescript-eslint/naming-convention': off # TODO consider
'@typescript-eslint/no-base-to-string': error
'@typescript-eslint/no-dynamic-delete': off
Expand All @@ -468,6 +539,7 @@ overrides:
'@typescript-eslint/no-non-null-asserted-optional-chain': error
'@typescript-eslint/no-non-null-assertion': error
'@typescript-eslint/no-parameter-properties': error
'@typescript-eslint/no-invalid-void-type': error
'@typescript-eslint/no-require-imports': error
'@typescript-eslint/no-this-alias': error
'@typescript-eslint/no-throw-literal': error
Expand All @@ -477,6 +549,10 @@ overrides:
'@typescript-eslint/no-unnecessary-qualifier': error
'@typescript-eslint/no-unnecessary-type-arguments': error
'@typescript-eslint/no-unnecessary-type-assertion': error
'@typescript-eslint/no-unsafe-assignment': off # TODO consider
'@typescript-eslint/no-unsafe-call': off # TODO consider
'@typescript-eslint/no-unsafe-member-access': off # TODO consider
'@typescript-eslint/no-unsafe-return': off # TODO consider
'@typescript-eslint/no-unused-vars-experimental': off
'@typescript-eslint/no-var-requires': error
'@typescript-eslint/prefer-as-const': off # TODO consider
Expand All @@ -487,8 +563,10 @@ overrides:
'@typescript-eslint/prefer-nullish-coalescing': error
'@typescript-eslint/prefer-optional-chain': error
'@typescript-eslint/prefer-readonly': error
'@typescript-eslint/prefer-readonly-parameter-types': off # FIXME: crash eslint
'@typescript-eslint/prefer-readonly-parameter-types': off # TODO consider
'@typescript-eslint/prefer-reduce-type-parameter': error
'@typescript-eslint/prefer-regexp-exec': error
'@typescript-eslint/prefer-ts-expect-error': error
'@typescript-eslint/prefer-string-starts-ends-with': off # TODO switch to error after IE11 drop
'@typescript-eslint/promise-function-async': off
'@typescript-eslint/require-array-sort-compare': error
Expand All @@ -507,18 +585,25 @@ overrides:

# Disable conflicting ESLint rules and enable TS-compatible ones
default-param-last: off
dot-notation: off
lines-between-class-members: off
no-array-constructor: off
no-dupe-class-members: off
no-empty-function: off
no-invalid-this: off
no-unused-expressions: off
no-unused-vars: off
no-useless-constructor: off
require-await: off
no-return-await: off
'@typescript-eslint/default-param-last': error
'@typescript-eslint/no-dupe-class-members': error
'@typescript-eslint/dot-notation': error
'@typescript-eslint/lines-between-class-members':
[error, always, { exceptAfterSingleLine: true }]
'@typescript-eslint/no-array-constructor': error
'@typescript-eslint/no-dupe-class-members': error
'@typescript-eslint/no-empty-function': error
'@typescript-eslint/no-invalid-this': error
'@typescript-eslint/no-unused-expressions': error
'@typescript-eslint/no-unused-vars':
[error, { vars: all, args: all, argsIgnorePattern: '^_' }]
Expand All @@ -527,6 +612,7 @@ overrides:
'@typescript-eslint/return-await': error

# Disable for JS, Flow and TS
'@typescript-eslint/init-declarations': off
'@typescript-eslint/no-magic-numbers': off
'@typescript-eslint/no-use-before-define': off

Expand All @@ -537,6 +623,7 @@ overrides:
'@typescript-eslint/comma-spacing': off
'@typescript-eslint/func-call-spacing': off
'@typescript-eslint/indent': off
'@typescript-eslint/keyword-spacing': off
'@typescript-eslint/member-delimiter-style': off
'@typescript-eslint/no-extra-parens': off
'@typescript-eslint/no-extra-semi': off
Expand All @@ -545,19 +632,25 @@ overrides:
'@typescript-eslint/type-annotation-spacing': off
- files: '**/__*__/**'
rules:
import/no-extraneous-dependencies: off
node/no-unpublished-import: off
node/no-unpublished-require: off
import/no-restricted-paths: off
import/no-extraneous-dependencies: [error, { devDependencies: true }]
import/no-nodejs-modules: off
no-restricted-syntax: off
- files: 'resources/**'
parserOptions:
sourceType: script
rules:
node/no-unpublished-import: off
node/no-unpublished-require: off
node/no-missing-require: off
node/no-sync: off
node/global-require: off
import/no-dynamic-require: off
import/no-extraneous-dependencies: off
import/no-extraneous-dependencies: [error, { devDependencies: true }]
import/no-nodejs-modules: off
import/no-commonjs: off
no-await-in-loop: off
no-restricted-syntax: off
no-console: off
no-sync: off
global-require: off
3 changes: 1 addition & 2 deletions .flowconfig
Expand Up @@ -3,7 +3,6 @@
!<PROJECT_ROOT>/src
!<PROJECT_ROOT>/node_modules/chai
!<PROJECT_ROOT>/node_modules/mocha
!<PROJECT_ROOT>/node_modules/iterall

[include]

Expand Down Expand Up @@ -40,4 +39,4 @@ suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$DisableFlowOnNegativeTest

[version]
^0.120.0
^0.126.0

0 comments on commit 4881a33

Please sign in to comment.