Skip to content

Commit

Permalink
Merge branch 'master' into wxue_support_required_field
Browse files Browse the repository at this point in the history
  • Loading branch information
xuewei8910 authored Dec 3, 2020
2 parents d64481c + cd273ad commit 171b437
Show file tree
Hide file tree
Showing 349 changed files with 9,943 additions and 7,999 deletions.
14 changes: 8 additions & 6 deletions .babelrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@
"plugins": ["@babel/plugin-transform-flow-strip-types"],
"overrides": [
{
"exclude": [
"src/__testUtils__/**/*",
"**/__tests__/**/*",
"**/__fixtures__/**/*"
],
"exclude": ["src/__testUtils__/**/*", "**/__tests__/**/*"],
"presets": ["@babel/preset-env"],
"plugins": [
["@babel/plugin-transform-classes", { "loose": true }],
Expand All @@ -18,7 +14,13 @@
"env": {
"cjs": {
"presets": [["@babel/preset-env", { "modules": "commonjs" }]],
"plugins": ["./resources/inline-invariant"]
"plugins": [
[
"./resources/add-extension-to-import-paths",
{ "extension": "js" }
],
"./resources/inline-invariant"
]
},
"mjs": {
"presets": [["@babel/preset-env", { "modules": false }]],
Expand Down
20 changes: 10 additions & 10 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Copied from '.gitignore', please keep it in sync.
.eslintcache
node_modules
coverage
npmDist
denoDist
benchmarkDist
integrationTmp
npm
deno
/.eslintcache
/node_modules
/coverage
/npmDist
/denoDist
/npm
/deno

# Ignore Flow typings for 3rd-party libraries
/flow-typed
# Ignore TS files inside integration test
integrationTests/ts/*.ts
/integrationTests/ts/*.ts
179 changes: 105 additions & 74 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
parser: babel-eslint
parserOptions:
sourceType: module
sourceType: script
ecmaVersion: 2020
env:
es6: true
node: true
reportUnusedDisableDirectives: true
plugins:
- internal-rules
- flowtype
- node
- istanbul
- import
settings:
flowtype:
onlyFilesWithFlowAnnotation: true
node:
tryExtensions: ['.js', '.json', '.node', '.ts', '.d.ts']

Expand All @@ -25,54 +22,6 @@ rules:

internal-rules/no-dir-import: error

##############################################################################
# `eslint-plugin-flowtype` rule list based on `v5.2.x`
# https://github.com/gajus/eslint-plugin-flowtype#eslint-plugin-flowtype
##############################################################################

flowtype/array-style-complex-type: error
flowtype/array-style-simple-type: error
flowtype/define-flow-type: error
flowtype/newline-after-flow-annotation: error
flowtype/no-dupe-keys: error
flowtype/no-existential-type: off # checked by Flow
flowtype/no-flow-fix-me-comments: off
flowtype/no-mixed: off
flowtype/no-mutable-array: off
flowtype/no-primitive-constructor-types: error
flowtype/no-types-missing-file-annotation: error
flowtype/no-unused-expressions: off
flowtype/no-weak-types: [error, { any: false }]
flowtype/require-compound-type-alias: off
flowtype/require-exact-type: off
flowtype/require-indexer-name: error
flowtype/require-inexact-type: off # checked by Flow
flowtype/require-parameter-type: off
flowtype/require-readonly-react-props: off
flowtype/require-return-type: off
flowtype/require-types-at-top: off
flowtype/require-valid-file-annotation:
[error, always, { annotationStyle: line, strict: true }]
flowtype/require-variable-type: off
flowtype/sort-keys: off
flowtype/spread-exact-type: off
flowtype/type-id-match: [error, '^[A-Z]']
flowtype/type-import-style: [error, declaration]
flowtype/use-flow-type: error

# Bellow rules are disabled because coflicts with Prettier, see:
# https://github.com/prettier/eslint-config-prettier/blob/master/flowtype.js
flowtype/arrow-parens: off
flowtype/boolean-style: off
flowtype/delimiter-dangle: off
flowtype/generic-spacing: off
flowtype/object-type-delimiter: off
flowtype/semi: off
flowtype/space-after-type-colon: off
flowtype/space-before-generic-bracket: off
flowtype/space-before-type-colon: off
flowtype/union-intersection-spacing: off

##############################################################################
# `eslint-plugin-istanbul` rule list based on `v0.1.2`
# https://github.com/istanbuljs/eslint-plugin-istanbul#rules
Expand Down Expand Up @@ -148,7 +97,6 @@ rules:
- 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 @@ -195,7 +143,7 @@ rules:
import/dynamic-import-chunkname: off

##############################################################################
# ESLint builtin rules list based on `v7.3.x`
# ESLint builtin rules list based on `v7.13.x`
##############################################################################

# Possible Errors
Expand Down Expand Up @@ -350,7 +298,7 @@ rules:
func-name-matching: off
func-names: off
func-style: off
id-blacklist: off
id-denylist: off
id-length: off
id-match: [error, '^(?:_?[a-zA-Z0-9]*)|[_A-Z0-9]+$']
line-comment-position: off
Expand All @@ -364,7 +312,7 @@ rules:
max-statements: off
max-statements-per-line: off
multiline-comment-style: off
new-cap: off # TODO
new-cap: error
no-array-constructor: error
no-bitwise: off
no-continue: off
Expand All @@ -384,7 +332,7 @@ rules:
runtime dependencies. Instead, use explicit Promises.
no-tabs: error
no-ternary: off
no-underscore-dangle: off
no-underscore-dangle: off # TODO
no-unneeded-ternary: error
one-var: [error, never]
operator-assignment: error
Expand Down Expand Up @@ -491,19 +439,72 @@ rules:
yield-star-spacing: off

overrides:
- files: 'src/**/*.js'
parser: babel-eslint
parserOptions:
sourceType: module
plugins:
- flowtype

rules:
##############################################################################
# `eslint-plugin-flowtype` rule list based on `v5.2.x`
# https://github.com/gajus/eslint-plugin-flowtype#eslint-plugin-flowtype
##############################################################################

flowtype/array-style-complex-type: error
flowtype/array-style-simple-type: error
flowtype/define-flow-type: error
flowtype/newline-after-flow-annotation: error
flowtype/no-dupe-keys: error
flowtype/no-existential-type: off # checked by Flow
flowtype/no-flow-fix-me-comments: off
flowtype/no-mixed: off
flowtype/no-mutable-array: off
flowtype/no-primitive-constructor-types: error
flowtype/no-types-missing-file-annotation: off
flowtype/no-unused-expressions: off
flowtype/no-weak-types: [error, { any: false }]
flowtype/require-compound-type-alias: off
flowtype/require-exact-type: off
flowtype/require-indexer-name: error
flowtype/require-inexact-type: off # checked by Flow
flowtype/require-parameter-type: off
flowtype/require-readonly-react-props: off
flowtype/require-return-type: off
flowtype/require-types-at-top: off
flowtype/require-valid-file-annotation: off
flowtype/require-variable-type: off
flowtype/sort-keys: off
flowtype/spread-exact-type: off
flowtype/type-id-match: [error, '^[A-Z]']
flowtype/type-import-style: [error, declaration]
flowtype/use-flow-type: error

# Bellow rules are disabled because coflicts with Prettier, see:
# https://github.com/prettier/eslint-config-prettier/blob/master/flowtype.js
flowtype/arrow-parens: off
flowtype/boolean-style: off
flowtype/delimiter-dangle: off
flowtype/generic-spacing: off
flowtype/object-type-delimiter: off
flowtype/semi: off
flowtype/space-after-type-colon: off
flowtype/space-before-generic-bracket: off
flowtype/space-before-type-colon: off
flowtype/union-intersection-spacing: off
- files: '**/*.ts'
parser: '@typescript-eslint/parser'
parserOptions:
sourceType: module
project: ['tsconfig.json']
plugins:
- '@typescript-eslint'
extends:
- plugin:import/typescript
rules:
flowtype/no-types-missing-file-annotation: off

##########################################################################
# `@typescript-eslint/eslint-plugin` rule list based on `v3.5.x`
# `@typescript-eslint/eslint-plugin` rule list based on `v4.8.x`
##########################################################################

# Supported Rules
Expand All @@ -514,10 +515,12 @@ overrides:
'@typescript-eslint/ban-ts-comment': [error, { 'ts-expect-error': false }]
'@typescript-eslint/ban-tslint-comment': error
'@typescript-eslint/ban-types': error
'@typescript-eslint/class-literal-property-style': off
'@typescript-eslint/class-literal-property-style': off # TODO enable after TS conversion
'@typescript-eslint/consistent-indexed-object-style': off # TODO enable after TS conversion
'@typescript-eslint/consistent-type-assertions':
[error, { assertionStyle: as, objectLiteralTypeAssertions: never }]
'@typescript-eslint/consistent-type-definitions': off # TODO consider
'@typescript-eslint/consistent-type-imports': off # TODO enable after TS conversion
'@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
Expand All @@ -526,13 +529,15 @@ overrides:
'@typescript-eslint/naming-convention': off # TODO consider
'@typescript-eslint/no-base-to-string': error
'@typescript-eslint/no-confusing-non-null-assertion': error
'@typescript-eslint/no-confusing-void-expression': error
'@typescript-eslint/no-dynamic-delete': off
'@typescript-eslint/no-empty-interface': error
'@typescript-eslint/no-explicit-any': off # TODO error
'@typescript-eslint/no-extra-non-null-assertion': error
'@typescript-eslint/no-extraneous-class': off # TODO consider
'@typescript-eslint/no-floating-promises': error
'@typescript-eslint/no-for-in-array': error
'@typescript-eslint/no-implicit-any-catch': off # TODO: Enable after TS convertion
'@typescript-eslint/no-implied-eval': error
'@typescript-eslint/no-inferrable-types':
[error, { ignoreParameters: true, ignoreProperties: true }]
Expand All @@ -552,16 +557,18 @@ overrides:
'@typescript-eslint/no-unnecessary-qualifier': error
'@typescript-eslint/no-unnecessary-type-arguments': error
'@typescript-eslint/no-unnecessary-type-assertion': error
'@typescript-eslint/no-unnecessary-type-constraint': off # TODO consider
'@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
'@typescript-eslint/prefer-enum-initializers': off # TODO consider
'@typescript-eslint/prefer-for-of': off # TODO switch to error after TS migration
'@typescript-eslint/prefer-function-type': error
'@typescript-eslint/prefer-includes': off # TODO switch to error after IE11 drop
'@typescript-eslint/prefer-literal-enum-member': error
'@typescript-eslint/prefer-namespace-keyword': error
'@typescript-eslint/prefer-nullish-coalescing': error
'@typescript-eslint/prefer-optional-chain': error
Expand Down Expand Up @@ -594,7 +601,10 @@ overrides:
no-dupe-class-members: off
no-empty-function: off
no-invalid-this: off
no-loop-func: off
no-loss-of-precision: off
no-redeclare: off
no-shadow: off
no-unused-expressions: off
no-unused-vars: off
no-useless-constructor: off
Expand All @@ -608,10 +618,21 @@ overrides:
'@typescript-eslint/no-dupe-class-members': error
'@typescript-eslint/no-empty-function': error
'@typescript-eslint/no-invalid-this': error
'@typescript-eslint/no-loop-func': error
'@typescript-eslint/no-loss-of-precision': error
'@typescript-eslint/no-redeclare': error
'@typescript-eslint/no-shadow': error
'@typescript-eslint/no-unused-expressions': error
'@typescript-eslint/no-unused-vars':
[error, { vars: all, args: all, argsIgnorePattern: '^_' }]
[
error,
{
vars: all,
args: all,
argsIgnorePattern: '^_',
varsIgnorePattern: '^_T',
},
]
'@typescript-eslint/no-useless-constructor': error
'@typescript-eslint/require-await': error
'@typescript-eslint/return-await': error
Expand All @@ -620,11 +641,13 @@ overrides:
'@typescript-eslint/init-declarations': off
'@typescript-eslint/no-magic-numbers': off
'@typescript-eslint/no-use-before-define': off
'@typescript-eslint/no-duplicate-imports': off # Superseded by `import/no-duplicates`

# Bellow rules are disabled because coflicts with Prettier, see:
# https://github.com/prettier/eslint-config-prettier/blob/master/%40typescript-eslint.js
'@typescript-eslint/quotes': off
'@typescript-eslint/brace-style': off
'@typescript-eslint/comma-dangle': off
'@typescript-eslint/comma-spacing': off
'@typescript-eslint/func-call-spacing': off
'@typescript-eslint/indent': off
Expand All @@ -634,28 +657,36 @@ overrides:
'@typescript-eslint/no-extra-semi': off
'@typescript-eslint/semi': off
'@typescript-eslint/space-before-function-paren': off
'@typescript-eslint/space-infix-ops': off
'@typescript-eslint/type-annotation-spacing': off
- files: '**/__*__/**'
- files: 'src/**/__*__/**'
rules:
node/no-unpublished-import: off
node/no-unpublished-require: off
node/no-unpublished-import: [error, { allowModules: ['chai', 'mocha'] }]
import/no-restricted-paths: off
import/no-extraneous-dependencies: [error, { devDependencies: true }]
import/no-nodejs-modules: off
no-restricted-syntax: off
- files: 'integrationTests/**'
parserOptions:
sourceType: script
- files: 'integrationTests/*'
rules:
node/no-unpublished-import: off
node/no-unpublished-require: off
node/no-sync: off
import/no-extraneous-dependencies: [error, { devDependencies: true }]
import/no-nodejs-modules: off
- files: 'integrationTests/*/**'
rules:
node/no-sync: off
node/no-missing-require: off
import/no-nodejs-modules: off
no-console: off
- files: 'benchmark/**'
rules:
node/no-sync: off
node/no-missing-require: off
import/no-nodejs-modules: off
import/no-commonjs: off
no-console: off
no-await-in-loop: off
no-restricted-syntax: off
- files: 'resources/**'
parserOptions:
sourceType: script
rules:
node/no-unpublished-import: off
node/no-unpublished-require: off
Expand Down
Loading

0 comments on commit 171b437

Please sign in to comment.