diff --git a/package.json b/package.json index 08df886..a2b589a 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "scripts": { "changelog": "lerna-changelog", "publish": "lerna publish", - "lint": "eslint . --ext js", + "lint": "eslint --ext .js ./", "test": "echo \"Error: no test specified\" && exit 1" }, "repository": { diff --git a/packages/eslint-config/README.md b/packages/eslint-config/README.md index 93d5507..5891d34 100644 --- a/packages/eslint-config/README.md +++ b/packages/eslint-config/README.md @@ -82,3 +82,10 @@ } ``` +### jest 环境 +`npm i -D @mjolnir/eslint-config eslint eslint-plugin-jest` + +#### 配置 +```json + +``` diff --git a/packages/eslint-config/babel.js b/packages/eslint-config/babel.js index 4e4c21d..f2f10d6 100644 --- a/packages/eslint-config/babel.js +++ b/packages/eslint-config/babel.js @@ -1,6 +1,6 @@ +'use strict'; + +// for babel env, base on es6 env module.exports = { - extends: [ - './index', // 基于 es6 的配置 - './plugins/babel' - ].map(require.resolve) + extends: ['./index', './plugins/babel'].map(require.resolve) }; diff --git a/packages/eslint-config/index.js b/packages/eslint-config/index.js index fe49cf8..e4efc61 100644 --- a/packages/eslint-config/index.js +++ b/packages/eslint-config/index.js @@ -1,15 +1,20 @@ +'use strict'; + // for es6 env module.exports = { + root: true, // limit ESLint to a specific project + env: { + browser: true, + es6: true // also enable ecmaVersion: 6 + }, parserOptions: { - ecmaVersion: 2018, - sourceType: 'module', + ecmaVersion: 2018, // same as 9 + sourceType: 'module', // ECMAScript module ecmaFeatures: { + globalReturn: false, + impliedStrict: true, jsx: true } }, - env: { - browser: true, - es6: true - }, extends: ['./rules', './plugins/import'].map(require.resolve) }; diff --git a/packages/eslint-config/jest.js b/packages/eslint-config/jest.js new file mode 100644 index 0000000..41ab15f --- /dev/null +++ b/packages/eslint-config/jest.js @@ -0,0 +1,7 @@ +'use strict'; + +// for jest env +module.exports = { + extends: ['./index', './plugins/jest'].map(require.resolve), + rules: {} +}; diff --git a/packages/eslint-config/node.js b/packages/eslint-config/node.js index 6a453ef..b72f379 100644 --- a/packages/eslint-config/node.js +++ b/packages/eslint-config/node.js @@ -1,4 +1,8 @@ +'use strict'; + // for nodejs env, support es6+ syntax module.exports = { - extends: ['./rules', './plugins/node'].map(require.resolve) + root: true, // limit ESLint to a specific project + extends: ['./rules', './plugins/node'].map(require.resolve), + rules: {} }; diff --git a/packages/eslint-config/package.json b/packages/eslint-config/package.json index 66af883..cf05727 100644 --- a/packages/eslint-config/package.json +++ b/packages/eslint-config/package.json @@ -12,7 +12,7 @@ "url": "https://github.com/mjolnirjs/mjolnir/issues" }, "scripts": { - "test": "prettier --version" + "lint": "eslint --print-config ./index.js" }, "keywords": [ "eslint", @@ -22,9 +22,12 @@ ], "license": "MIT", "peerDependencies": { - "eslint": "^5.16.0 || ^6.0.0" + "eslint": "^6.0.0" }, "publishConfig": { "access": "public" + }, + "engines": { + "node": ">=8.0.0" } } diff --git a/packages/eslint-config/plugins/babel.js b/packages/eslint-config/plugins/babel.js index 6de2354..7d998f8 100644 --- a/packages/eslint-config/plugins/babel.js +++ b/packages/eslint-config/plugins/babel.js @@ -1,3 +1,5 @@ +'use strict'; + // eslint-plugin-babel has no recommend config module.exports = { parser: 'babel-eslint', diff --git a/packages/eslint-config/plugins/import.js b/packages/eslint-config/plugins/import.js index 59fb1fe..842e043 100644 --- a/packages/eslint-config/plugins/import.js +++ b/packages/eslint-config/plugins/import.js @@ -1,3 +1,5 @@ +'use strict'; + module.exports = { plugins: ['import'], rules: { diff --git a/packages/eslint-config/plugins/jest.js b/packages/eslint-config/plugins/jest.js new file mode 100644 index 0000000..1d8b820 --- /dev/null +++ b/packages/eslint-config/plugins/jest.js @@ -0,0 +1,7 @@ +'use strict'; + +// plugin:jest/recommended: https://github.com/jest-community/eslint-plugin-jest/blob/master/README.md +module.exports = { + extends: ['plugin:jest/recommended'], + rules: {} +}; diff --git a/packages/eslint-config/plugins/node.js b/packages/eslint-config/plugins/node.js index 0df2a51..3df8be2 100644 --- a/packages/eslint-config/plugins/node.js +++ b/packages/eslint-config/plugins/node.js @@ -1,40 +1,10 @@ +'use strict'; + +// plugin:node/recommended: https://github.com/mysticatea/eslint-plugin-node/blob/master/lib/index.js module.exports = { extends: ['plugin:node/recommended'], rules: { - // enforce return after a callback - 'callback-return': 'off', - - // require all requires be top-level - // https://eslint.org/docs/rules/global-require - 'global-require': 'error', - - // enforces error handling in callbacks (node environment) - 'handle-callback-err': 'off', - - // disallow use of the Buffer() constructor - // https://eslint.org/docs/rules/no-buffer-constructor - 'no-buffer-constructor': 'error', - - // disallow mixing regular variable and require declarations - 'no-mixed-requires': ['off', false], - - // disallow use of new operator with the require function - 'no-new-require': 'error', - - // disallow string concatenation with __dirname and __filename - // https://eslint.org/docs/rules/no-path-concat - 'no-path-concat': 'error', - - // disallow use of process.env - 'no-process-env': 'off', - - // disallow process.exit() - 'no-process-exit': 'off', - - // restrict usage of specified node modules - 'no-restricted-modules': 'off', - - // disallow use of synchronous methods (off by default) - 'no-sync': 'off' + // commonjs or node env, should use global strict model + strict: ['error', 'global'] } }; diff --git a/packages/eslint-config/plugins/react-hooks.js b/packages/eslint-config/plugins/react-hooks.js index 392f5d1..9cdf437 100644 --- a/packages/eslint-config/plugins/react-hooks.js +++ b/packages/eslint-config/plugins/react-hooks.js @@ -1,3 +1,5 @@ +'use strict'; + module.exports = { plugins: ['react-hooks'], rules: { diff --git a/packages/eslint-config/plugins/react.js b/packages/eslint-config/plugins/react.js index 98aaad5..97fd4d7 100644 --- a/packages/eslint-config/plugins/react.js +++ b/packages/eslint-config/plugins/react.js @@ -1,453 +1,6 @@ +'use strict'; + module.exports = { plugins: ['react'], - // View link below for react rules documentation - // https://github.com/yannickcr/eslint-plugin-react#list-of-supported-rules - rules: { - // Specify whether double or single quotes should be used in JSX attributes - // https://eslint.org/docs/rules/jsx-quotes - 'jsx-quotes': ['error', 'prefer-double'], - - 'class-methods-use-this': 'off', - - // Prevent missing displayName in a React component definition - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/display-name.md - 'react/display-name': ['off', { ignoreTranspilerName: false }], - - // Forbid certain propTypes (any, array, object) - // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/forbid-prop-types.md - 'react/forbid-prop-types': 'warn', - - // Forbid certain props on DOM Nodes - // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/forbid-dom-props.md - 'react/forbid-dom-props': ['off', { forbid: [] }], - - // Enforce boolean attributes notation in JSX - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md - 'react/jsx-boolean-value': ['error', 'never', { always: [] }], - - // Validate closing bracket location in JSX - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-closing-bracket-location.md - 'react/jsx-closing-bracket-location': ['error', 'line-aligned'], - - // Validate closing tag location in JSX - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-closing-tag-location.md - 'react/jsx-closing-tag-location': 'error', - - // Enforce or disallow spaces inside of curly braces in JSX attributes - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-spacing.md - 'react/jsx-curly-spacing': ['error', 'never', { allowMultiline: true }], - - // Enforce event handler naming conventions in JSX - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-handler-names.md - 'react/jsx-handler-names': [ - 'off', - { - eventHandlerPrefix: 'handle', - eventHandlerPropPrefix: 'on' - } - ], - - // Validate props indentation in JSX - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-indent-props.md - 'react/jsx-indent-props': ['error', 2], - - // Validate JSX has key prop when in array or iterator - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-key.md - 'react/jsx-key': 'off', - - // Limit maximum of props on a single line in JSX - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-max-props-per-line.md - 'react/jsx-max-props-per-line': [ - 'error', - { maximum: 1, when: 'multiline' } - ], - - // Prevent usage of .bind() in JSX props - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-bind.md - 'react/jsx-no-bind': [ - 'error', - { - ignoreRefs: true, - allowArrowFunctions: true, - allowBind: false - } - ], - - // Prevent duplicate props in JSX - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-duplicate-props.md - 'react/jsx-no-duplicate-props': ['error', { ignoreCase: true }], - - // Prevent usage of unwrapped JSX strings - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-literals.md - 'react/jsx-no-literals': ['off', { noStrings: true }], - - // Disallow undeclared variables in JSX - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-undef.md - 'react/jsx-no-undef': 'error', - - // Enforce PascalCase for user-defined JSX components - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md - 'react/jsx-pascal-case': [ - 'error', - { - allowAllCaps: true, - ignore: [] - } - ], - - // Enforce propTypes declarations alphabetical sorting - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-prop-types.md - 'react/sort-prop-types': [ - 'off', - { - ignoreCase: true, - callbacksLast: false, - requiredFirst: false, - sortShapeProp: true - } - ], - - // Deprecated in favor of react/jsx-sort-props - 'react/jsx-sort-prop-types': 'off', - - // Enforce props alphabetical sorting - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md - 'react/jsx-sort-props': [ - 'off', - { - ignoreCase: true, - callbacksLast: false, - shorthandFirst: false, - shorthandLast: false, - noSortAlphabetically: false, - reservedFirst: true - } - ], - - // Enforce defaultProps declarations alphabetical sorting - // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-sort-default-props.md - 'react/jsx-sort-default-props': [ - 'off', - { - ignoreCase: true - } - ], - - // Prevent React to be incorrectly marked as unused - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-react.md - 'react/jsx-uses-react': ['error'], - - // Prevent variables used in JSX to be incorrectly marked as unused - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-vars.md - 'react/jsx-uses-vars': 'error', - - // Prevent usage of dangerous JSX properties - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-danger.md - 'react/no-danger': 'warn', - - // Prevent usage of deprecated methods - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-deprecated.md - 'react/no-deprecated': ['error'], - - // Prevent usage of setState in componentDidMount - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-mount-set-state.md - // this is necessary for server-rendering - 'react/no-did-mount-set-state': 'off', - - // Prevent usage of setState in componentDidUpdate - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-update-set-state.md - 'react/no-did-update-set-state': 'error', - - // Prevent usage of setState in componentWillUpdate - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-will-update-set-state.md - 'react/no-will-update-set-state': 'error', - - // Prevent direct mutation of this.state - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-direct-mutation-state.md - 'react/no-direct-mutation-state': 'off', - - // Prevent usage of isMounted - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-is-mounted.md - 'react/no-is-mounted': 'error', - - // Prevent multiple component definition per file - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-multi-comp.md - 'react/no-multi-comp': ['error', { ignoreStateless: true }], - - // Prevent usage of setState - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-set-state.md - 'react/no-set-state': 'off', - - // Prevent using string references - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-string-refs.md - 'react/no-string-refs': 'error', - - // Prevent usage of unknown DOM property - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md - 'react/no-unknown-property': 'error', - - // Require ES6 class declarations over React.createClass - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-es6-class.md - 'react/prefer-es6-class': ['error', 'always'], - - // Require stateless functions when not using lifecycle methods, setState or ref - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-stateless-function.md - 'react/prefer-stateless-function': 'off', - - // Prevent missing props validation in a React component definition - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prop-types.md - 'react/prop-types': [ - 'error', - { - ignore: [], - customValidators: [], - skipUndeclared: false - } - ], - - // Prevent missing React when using JSX - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/react-in-jsx-scope.md - 'react/react-in-jsx-scope': 'error', - - // Require render() methods to return something - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-render-return.md - 'react/require-render-return': 'error', - - // Prevent extra closing tags for components without children - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md - 'react/self-closing-comp': 'warn', - - // Enforce component methods order - // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/sort-comp.md - 'react/sort-comp': [ - 'error', - { - order: [ - 'static-methods', - 'instance-variables', - 'lifecycle', - '/^on.+$/', - 'getters', - 'setters', - '/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/', - 'instance-methods', - 'everything-else', - 'rendering' - ], - groups: { - lifecycle: [ - 'displayName', - 'propTypes', - 'contextTypes', - 'childContextTypes', - 'mixins', - 'statics', - 'defaultProps', - 'constructor', - 'getDefaultProps', - 'getInitialState', - 'state', - 'getChildContext', - 'componentWillMount', - 'componentDidMount', - 'componentWillReceiveProps', - 'shouldComponentUpdate', - 'componentWillUpdate', - 'componentDidUpdate', - 'componentWillUnmount' - ], - rendering: ['/^render.+$/', 'render'] - } - } - ], - - // Prevent missing parentheses around multilines JSX - // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-wrap-multilines.md - 'react/jsx-wrap-multilines': [ - 'error', - { - declaration: 'parens-new-line', - assignment: 'parens-new-line', - return: 'parens-new-line', - arrow: 'parens-new-line', - condition: 'parens-new-line', - logical: 'parens-new-line', - prop: 'parens-new-line' - } - ], - - // Require that the first prop in a JSX element be on a new line when the element is multiline - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-first-prop-new-line.md - 'react/jsx-first-prop-new-line': ['error', 'multiline-multiprop'], - - // Enforce spacing around jsx equals signs - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-equals-spacing.md - 'react/jsx-equals-spacing': ['error', 'never'], - - // Enforce JSX indentation - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-indent.md - 'react/jsx-indent': ['error', 2], - - // Disallow target="_blank" on links - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-target-blank.md - 'react/jsx-no-target-blank': 'error', - - // only .jsx files may have JSX - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md - 'react/jsx-filename-extension': 'off', - - // prevent accidental JS comments from being injected into JSX as text - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-comment-textnodes.md - 'react/jsx-no-comment-textnodes': 'error', - - // disallow using React.render/ReactDOM.render's return value - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-render-return-value.md - 'react/no-render-return-value': 'error', - - // require a shouldComponentUpdate method, or PureRenderMixin - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-optimization.md - 'react/require-optimization': ['off', { allowDecorators: [] }], - - // warn against using findDOMNode() - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-find-dom-node.md - 'react/no-find-dom-node': 'error', - - // Forbid certain props on Components - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-component-props.md - 'react/forbid-component-props': ['off', { forbid: [] }], - - // Forbid certain elements - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-elements.md - 'react/forbid-elements': ['off', { forbid: [] }], - - // Prevent problem with children and props.dangerouslySetInnerHTML - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-danger-with-children.md - 'react/no-danger-with-children': 'error', - - // Prevent unused propType definitions - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unused-prop-types.md - 'react/no-unused-prop-types': 'warn', - - // Require style prop value be an object or var - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/style-prop-object.md - 'react/style-prop-object': 'error', - - // Prevent invalid characters from appearing in markup - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unescaped-entities.md - 'react/no-unescaped-entities': 'error', - - // Prevent passing of children as props - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-children-prop.md - 'react/no-children-prop': 'error', - - // Validate whitespace in and around the JSX opening and closing brackets - // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-tag-spacing.md - 'react/jsx-tag-spacing': [ - 'error', - { - closingSlash: 'never', - beforeSelfClosing: 'always', - afterOpening: 'never', - beforeClosing: 'never' - } - ], - - // Enforce spaces before the closing bracket of self-closing JSX elements - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-space-before-closing.md - // Deprecated in favor of jsx-tag-spacing - 'react/jsx-space-before-closing': ['off', 'always'], - - // Prevent usage of Array index in keys - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md - 'react/no-array-index-key': 'error', - - // Enforce a defaultProps definition for every prop that is not a required prop - // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/require-default-props.md - 'react/require-default-props': [ - 'error', - { - forbidDefaultForRequired: true - } - ], - - // Forbids using non-exported propTypes - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-foreign-prop-types.md - // TODO: enable? - 'react/forbid-foreign-prop-types': ['off', { allowInPropTypes: true }], - - // Prevent void DOM elements from receiving children - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/void-dom-elements-no-children.md - 'react/void-dom-elements-no-children': 'error', - - // Enforce all defaultProps have a corresponding non-required PropType - // https://github.com/yannickcr/eslint-plugin-react/blob/9e13ae2c51e44872b45cc15bf1ac3a72105bdd0e/docs/rules/default-props-match-prop-types.md - 'react/default-props-match-prop-types': [ - 'error', - { allowRequiredDefaults: false } - ], - - // Prevent usage of shouldComponentUpdate when extending React.PureComponent - // https://github.com/yannickcr/eslint-plugin-react/blob/9e13ae2c51e44872b45cc15bf1ac3a72105bdd0e/docs/rules/no-redundant-should-component-update.md - 'react/no-redundant-should-component-update': 'error', - - // Prevent unused state values - // https://github.com/yannickcr/eslint-plugin-react/pull/1103/ - 'react/no-unused-state': 'warn', - - // Enforces consistent naming for boolean props - // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/boolean-prop-naming.md - 'react/boolean-prop-naming': [ - 'off', - { - propTypeNames: ['bool', 'mutuallyExclusiveTrueProps'], - rule: '^(is|has)[A-Z]([A-Za-z0-9]?)+', - message: '' - } - ], - - // Prevents common casing typos - // https://github.com/yannickcr/eslint-plugin-react/blob/73abadb697034b5ccb514d79fb4689836fe61f91/docs/rules/no-typos.md - 'react/no-typos': 'error', - - // Enforce curly braces or disallow unnecessary curly braces in JSX props and/or children - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-brace-presence.md - 'react/jsx-curly-brace-presence': [ - 'error', - { props: 'never', children: 'never' } - ], - - // One JSX Element Per Line - // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-one-expression-per-line.md - 'react/jsx-one-expression-per-line': 'error', - - // Enforce consistent usage of destructuring assignment of props, state, and context - // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/destructuring-assignment.md - 'react/destructuring-assignment': ['error', 'always'], - - // Prevent using this.state within a this.setState - // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/no-access-state-in-setstate.md - 'react/no-access-state-in-setstate': 'error', - - // Prevent usage of button elements without an explicit type attribute - // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/button-has-type.md - 'react/button-has-type': [ - 'error', - { - button: true, - submit: true, - reset: false - } - ], - - // Ensures inline tags are not rendered without spaces between them - 'react/jsx-child-element-spacing': 'off', - - // Prevent this from being used in stateless functional components - // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/no-this-in-sfc.md - 'react/no-this-in-sfc': 'error', - - // Validate JSX maximum depth - // https://github.com/yannickcr/eslint-plugin-react/blob/abe8381c0d6748047224c430ce47f02e40160ed0/docs/rules/jsx-max-depth.md - 'react/jsx-max-depth': 'off' - } + rules: {} }; diff --git a/packages/eslint-config/plugins/typescript.js b/packages/eslint-config/plugins/typescript.js index fd38f19..2e02e87 100644 --- a/packages/eslint-config/plugins/typescript.js +++ b/packages/eslint-config/plugins/typescript.js @@ -1,8 +1,12 @@ -// recommend has parser config: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/src/configs/base.json +'use strict'; + +// recommend config has parser config: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/src/configs/base.json module.exports = { + // TODO: 是否需要通过 override 设置检测 .ts,.tsx 文件? extends: [ - 'plugin:import/typescript', + 'plugin:@typescript-eslint/eslint-recommended', 'plugin:@typescript-eslint/recommended', - 'plugin:@typescript-eslint/eslint-recommended' - ] + 'plugin:import/typescript' + ], + rules: {} }; diff --git a/packages/eslint-config/react.js b/packages/eslint-config/react.js index 209ee0b..c40d7e2 100644 --- a/packages/eslint-config/react.js +++ b/packages/eslint-config/react.js @@ -1,3 +1,6 @@ +'use strict'; + +// for react env module.exports = { extends: ['./plugins/react', './plugins/react-hooks'].map(require.resolve) }; diff --git a/packages/eslint-config/rules/best-practices.js b/packages/eslint-config/rules/best-practices.js index 3d6fd59..4d22725 100644 --- a/packages/eslint-config/rules/best-practices.js +++ b/packages/eslint-config/rules/best-practices.js @@ -1,329 +1,4 @@ -module.exports = { - rules: { - // enforces getter/setter pairs in objects - 'accessor-pairs': 'off', +'use strict'; - // enforces return statements in callbacks of array's methods - // https://eslint.org/docs/rules/array-callback-return - 'array-callback-return': ['error', { allowImplicit: true }], - - // treat var statements as if they were block scoped - 'block-scoped-var': 'error', - - // specify the maximum cyclomatic complexity allowed in a program - complexity: ['off', 11], - - // enforce that class methods use "this" - // https://eslint.org/docs/rules/class-methods-use-this - 'class-methods-use-this': 'off', - - // require return statements to either always or never specify values - 'consistent-return': 'error', - - // specify curly brace conventions for all control statements - curly: ['error', 'multi-line'], - - // require default case in switch statements - 'default-case': ['error', { commentPattern: '^no default$' }], - - // encourages use of dot notation whenever possible - 'dot-notation': ['error', { allowKeywords: true }], - - // enforces consistent newlines before or after dots - // https://eslint.org/docs/rules/dot-location - 'dot-location': ['error', 'property'], - - // require the use of === and !== - // https://eslint.org/docs/rules/eqeqeq - eqeqeq: ['error', 'always', { null: 'ignore' }], - - // make sure for-in loops have an if statement - 'guard-for-in': 'error', - - // disallow the use of alert, confirm, and prompt - 'no-alert': 'warn', - - // disallow use of arguments.caller or arguments.callee - 'no-caller': 'error', - - // disallow lexical declarations in case/default clauses - // https://eslint.org/docs/rules/no-case-declarations.html - 'no-case-declarations': 'error', - - // disallow division operators explicitly at beginning of regular expression - // https://eslint.org/docs/rules/no-div-regex - 'no-div-regex': 'off', - - // disallow else after a return in an if - // https://eslint.org/docs/rules/no-else-return - 'no-else-return': ['error', { allowElseIf: false }], - - // disallow empty functions, except for standalone funcs/arrows - // https://eslint.org/docs/rules/no-empty-function - 'no-empty-function': [ - 'error', - { - allow: ['arrowFunctions', 'functions', 'methods'] - } - ], - - // disallow empty destructuring patterns - // https://eslint.org/docs/rules/no-empty-pattern - 'no-empty-pattern': 'error', - - // disallow comparisons to null without a type-checking operator - 'no-eq-null': 'off', - - // disallow use of eval() - 'no-eval': 'error', - - // disallow adding to native types - 'no-extend-native': 'error', - - // disallow unnecessary function binding - 'no-extra-bind': 'error', - - // disallow Unnecessary Labels - // https://eslint.org/docs/rules/no-extra-label - 'no-extra-label': 'error', - - // disallow fallthrough of case statements - 'no-fallthrough': 'error', - - // disallow the use of leading or trailing decimal points in numeric literals - 'no-floating-decimal': 'error', - - // disallow reassignments of native objects or read-only globals - // https://eslint.org/docs/rules/no-global-assign - 'no-global-assign': ['error', { exceptions: [] }], - // deprecated in favor of no-global-assign - 'no-native-reassign': 'off', - - // disallow implicit type conversions - // https://eslint.org/docs/rules/no-implicit-coercion - 'no-implicit-coercion': [ - 'off', - { - boolean: false, - number: true, - string: true, - allow: [] - } - ], - - // disallow var and named functions in global scope - // https://eslint.org/docs/rules/no-implicit-globals - 'no-implicit-globals': 'off', - - // disallow use of eval()-like methods - 'no-implied-eval': 'error', - - // disallow this keywords outside of classes or class-like objects - 'no-invalid-this': 'off', - - // disallow usage of __iterator__ property - 'no-iterator': 'error', - - // disallow use of labels for anything other then loops and switches - 'no-labels': ['error', { allowLoop: false, allowSwitch: false }], - - // disallow unnecessary nested blocks - 'no-lone-blocks': 'error', - - // disallow creation of functions within loops - 'no-loop-func': 'error', - - // disallow magic numbers - // https://eslint.org/docs/rules/no-magic-numbers - 'no-magic-numbers': [ - 'off', - { - ignore: [], - ignoreArrayIndexes: true, - enforceConst: true, - detectObjects: false - } - ], - - // disallow use of multiple spaces - 'no-multi-spaces': [ - 'error', - { - ignoreEOLComments: false - } - ], - - // disallow use of multiline strings - 'no-multi-str': 'error', - - // disallow use of new operator when not part of the assignment or comparison - 'no-new': 'error', - - // disallow use of new operator for Function object - 'no-new-func': 'error', - - // disallows creating new instances of String, Number, and Boolean - 'no-new-wrappers': 'error', - - // disallow use of (old style) octal literals - 'no-octal': 'error', - - // disallow use of octal escape sequences in string literals, such as - // var foo = 'Copyright \251'; - 'no-octal-escape': 'error', - - // disallow reassignment of function parameters - // disallow parameter object manipulation except for specific exclusions - // rule: https://eslint.org/docs/rules/no-param-reassign.html - 'no-param-reassign': 'off', - - // disallow usage of __proto__ property - 'no-proto': 'error', - - // disallow declaring the same variable more then once - 'no-redeclare': 'error', - - // disallow certain object properties - // https://eslint.org/docs/rules/no-restricted-properties - 'no-restricted-properties': [ - 'error', - { - object: 'arguments', - property: 'callee', - message: 'arguments.callee is deprecated' - }, - { - object: 'global', - property: 'isFinite', - message: 'Please use Number.isFinite instead' - }, - { - object: 'self', - property: 'isFinite', - message: 'Please use Number.isFinite instead' - }, - { - object: 'window', - property: 'isFinite', - message: 'Please use Number.isFinite instead' - }, - { - object: 'global', - property: 'isNaN', - message: 'Please use Number.isNaN instead' - }, - { - object: 'self', - property: 'isNaN', - message: 'Please use Number.isNaN instead' - }, - { - object: 'window', - property: 'isNaN', - message: 'Please use Number.isNaN instead' - }, - { - property: '__defineGetter__', - message: 'Please use Object.defineProperty instead.' - }, - { - property: '__defineSetter__', - message: 'Please use Object.defineProperty instead.' - }, - { - object: 'Math', - property: 'pow', - message: 'Use the exponentiation operator (**) instead.' - } - ], - - // disallow use of assignment in return statement - 'no-return-assign': ['error', 'always'], - - // disallow redundant `return await` - 'no-return-await': 'error', - - // disallow use of `javascript:` urls. - 'no-script-url': 'error', - - // disallow self assignment - // https://eslint.org/docs/rules/no-self-assign - 'no-self-assign': 'error', - - // disallow comparisons where both sides are exactly the same - 'no-self-compare': 'error', - - // disallow use of comma operator - 'no-sequences': 'error', - - // restrict what can be thrown as an exception - 'no-throw-literal': 'error', - - // disallow unmodified conditions of loops - // https://eslint.org/docs/rules/no-unmodified-loop-condition - 'no-unmodified-loop-condition': 'off', - - // disallow usage of expressions in statement position - 'no-unused-expressions': [ - 'error', - { - allowShortCircuit: false, - allowTernary: false, - allowTaggedTemplates: false - } - ], - - // disallow unused labels - // https://eslint.org/docs/rules/no-unused-labels - 'no-unused-labels': 'error', - - // disallow unnecessary .call() and .apply() - 'no-useless-call': 'off', - - // disallow useless string concatenation - // https://eslint.org/docs/rules/no-useless-concat - 'no-useless-concat': 'error', - - // disallow unnecessary string escaping - // https://eslint.org/docs/rules/no-useless-escape - 'no-useless-escape': 'error', - - // disallow redundant return; keywords - // https://eslint.org/docs/rules/no-useless-return - 'no-useless-return': 'error', - - // disallow use of void operator - // https://eslint.org/docs/rules/no-void - 'no-void': 'error', - - // disallow usage of configurable warning terms in comments: e.g. todo - 'no-warning-comments': [ - 'off', - { terms: ['todo', 'fixme', 'xxx'], location: 'start' } - ], - - // disallow use of the with statement - 'no-with': 'error', - - // require using Error objects as Promise rejection reasons - // https://eslint.org/docs/rules/prefer-promise-reject-errors - 'prefer-promise-reject-errors': ['error', { allowEmptyReject: true }], - - // require use of the second argument for parseInt() - radix: 'error', - - // require `await` in `async function` (note: this is a horrible rule that should never be used) - // https://eslint.org/docs/rules/require-await - 'require-await': 'off', - - // requires to declare all vars on top of their containing scope - 'vars-on-top': 'error', - - // require immediate function invocation to be wrapped in parentheses - // https://eslint.org/docs/rules/wrap-iife.html - 'wrap-iife': ['error', 'outside', { functionPrototypeMethods: false }], - - // require or disallow Yoda conditions - yoda: 'error' - } -}; +// Best Practices: https://eslint.org/docs/rules/#best-practices +module.exports = {}; diff --git a/packages/eslint-config/rules/errors.js b/packages/eslint-config/rules/errors.js index 3081e3b..2895e20 100644 --- a/packages/eslint-config/rules/errors.js +++ b/packages/eslint-config/rules/errors.js @@ -1,136 +1,4 @@ -module.exports = { - rules: { - // Enforce “for” loop update clause moving the counter in the right direction - // https://eslint.org/docs/rules/for-direction - 'for-direction': 'error', +'use strict'; - // Enforces that a return statement is present in property getters - // https://eslint.org/docs/rules/getter-return - 'getter-return': ['error', { allowImplicit: true }], - - // Disallow await inside of loops - // https://eslint.org/docs/rules/no-await-in-loop - 'no-await-in-loop': 'error', - - // Disallow comparisons to negative zero - // https://eslint.org/docs/rules/no-compare-neg-zero - 'no-compare-neg-zero': 'error', - - // disallow assignment in conditional expressions - 'no-cond-assign': ['error', 'always'], - - // disallow use of console - 'no-console': [ - 'warn', - { - allow: ['info', 'warn', 'error'] - } - ], - - // disallow use of constant expressions in conditions - 'no-constant-condition': 'warn', - - // disallow control characters in regular expressions - 'no-control-regex': 'error', - - // disallow use of debugger - 'no-debugger': 'error', - - // disallow duplicate arguments in functions - 'no-dupe-args': 'error', - - // disallow duplicate keys when creating object literals - 'no-dupe-keys': 'error', - - // disallow a duplicate case label. - 'no-duplicate-case': 'error', - - // disallow empty statements - 'no-empty': 'error', - - // disallow the use of empty character classes in regular expressions - 'no-empty-character-class': 'error', - - // disallow assigning to the exception in a catch block - 'no-ex-assign': 'error', - - // disallow double-negation boolean casts in a boolean context - // https://eslint.org/docs/rules/no-extra-boolean-cast - 'no-extra-boolean-cast': 'error', - - // disallow unnecessary parentheses - // https://eslint.org/docs/rules/no-extra-parens - 'no-extra-parens': [ - 'off', - 'all', - { - conditionalAssign: true, - nestedBinaryExpressions: false, - returnAssign: false, - ignoreJSX: 'all', // delegate to eslint-plugin-react - enforceForArrowConditionals: false - } - ], - - // disallow unnecessary semicolons - 'no-extra-semi': 'error', - - // disallow overwriting functions written as function declarations - 'no-func-assign': 'error', - - // disallow function or variable declarations in nested blocks - 'no-inner-declarations': 'error', - - // disallow invalid regular expression strings in the RegExp constructor - 'no-invalid-regexp': 'error', - - // disallow irregular whitespace outside of strings and comments - 'no-irregular-whitespace': 'error', - - // disallow the use of object properties of the global object (Math and JSON) as functions - 'no-obj-calls': 'error', - - // disallow use of Object.prototypes builtins directly - // https://eslint.org/docs/rules/no-prototype-builtins - 'no-prototype-builtins': 'error', - - // disallow multiple spaces in a regular expression literal - 'no-regex-spaces': 'error', - - // disallow sparse arrays - 'no-sparse-arrays': 'error', - - // Disallow template literal placeholder syntax in regular strings - // https://eslint.org/docs/rules/no-template-curly-in-string - 'no-template-curly-in-string': 'error', - - // Avoid code that looks like two expressions but is actually one - // https://eslint.org/docs/rules/no-unexpected-multiline - 'no-unexpected-multiline': 'error', - - // disallow unreachable statements after a return, throw, continue, or break statement - 'no-unreachable': 'error', - - // disallow return/throw/break/continue inside finally blocks - // https://eslint.org/docs/rules/no-unsafe-finally - 'no-unsafe-finally': 'error', - - // disallow negating the left operand of relational operators - // https://eslint.org/docs/rules/no-unsafe-negation - 'no-unsafe-negation': 'error', - // disallow negation of the left operand of an in expression - // deprecated in favor of no-unsafe-negation - 'no-negated-in-lhs': 'off', - - // disallow comparisons with the value NaN - 'use-isnan': 'error', - - // ensure JSDoc comments are valid - // https://eslint.org/docs/rules/valid-jsdoc - 'valid-jsdoc': 'off', - - // ensure that the results of typeof are compared against a valid string - // https://eslint.org/docs/rules/valid-typeof - 'valid-typeof': ['error', { requireStringLiterals: true }] - } -}; +// Possible Errors: https://eslint.org/docs/rules/#possible-errors +module.exports = {}; diff --git a/packages/eslint-config/rules/es6.js b/packages/eslint-config/rules/es6.js index b80635a..554a284 100644 --- a/packages/eslint-config/rules/es6.js +++ b/packages/eslint-config/rules/es6.js @@ -1,198 +1,4 @@ -module.exports = { - rules: { - // enforces no braces where they can be omitted - // https://eslint.org/docs/rules/arrow-body-style - 'arrow-body-style': [ - 'error', - 'as-needed', - { - requireReturnForObjectLiteral: false - } - ], +'use strict'; - // require parens in arrow function arguments - // https://eslint.org/docs/rules/arrow-parens - 'arrow-parens': [ - 'error', - 'as-needed', - { - requireForBlockBody: true - } - ], - - // require space before/after arrow function's arrow - // https://eslint.org/docs/rules/arrow-spacing - 'arrow-spacing': ['error', { before: true, after: true }], - - // verify super() callings in constructors - 'constructor-super': 'error', - - // enforce the spacing around the * in generator functions - // https://eslint.org/docs/rules/generator-star-spacing - 'generator-star-spacing': ['error', { before: false, after: true }], - - // disallow modifying variables of class declarations - // https://eslint.org/docs/rules/no-class-assign - 'no-class-assign': 'error', - - // disallow arrow functions where they could be confused with comparisons - // https://eslint.org/docs/rules/no-confusing-arrow - 'no-confusing-arrow': [ - 'error', - { - allowParens: true - } - ], - - // disallow modifying variables that are declared using const - 'no-const-assign': 'error', - - // disallow duplicate class members - // https://eslint.org/docs/rules/no-dupe-class-members - 'no-dupe-class-members': 'error', - - // disallow importing from the same path more than once - // https://eslint.org/docs/rules/no-duplicate-imports - // replaced by https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md - 'no-duplicate-imports': 'off', - - // disallow symbol constructor - // https://eslint.org/docs/rules/no-new-symbol - 'no-new-symbol': 'error', - - // disallow specific imports - // https://eslint.org/docs/rules/no-restricted-imports - 'no-restricted-imports': [ - 'off', - { - paths: [], - patterns: [] - } - ], - - // disallow to use this/super before super() calling in constructors. - // https://eslint.org/docs/rules/no-this-before-super - 'no-this-before-super': 'error', - - // disallow useless computed property keys - // https://eslint.org/docs/rules/no-useless-computed-key - 'no-useless-computed-key': 'error', - - // disallow unnecessary constructor - // https://eslint.org/docs/rules/no-useless-constructor - 'no-useless-constructor': 'error', - - // disallow renaming import, export, and destructured assignments to the same name - // https://eslint.org/docs/rules/no-useless-rename - 'no-useless-rename': [ - 'error', - { - ignoreDestructuring: false, - ignoreImport: false, - ignoreExport: false - } - ], - - // require let or const instead of var - 'no-var': 'error', - - // require method and property shorthand syntax for object literals - // https://eslint.org/docs/rules/object-shorthand - 'object-shorthand': [ - 'error', - 'always', - { - ignoreConstructors: false, - avoidQuotes: true - } - ], - - // suggest using arrow functions as callbacks - 'prefer-arrow-callback': [ - 'error', - { - allowNamedFunctions: false, - allowUnboundThis: true - } - ], - - // suggest using of const declaration for variables that are never modified after declared - 'prefer-const': [ - 'error', - { - destructuring: 'any', - ignoreReadBeforeAssign: true - } - ], - - // Prefer destructuring from arrays and objects - // https://eslint.org/docs/rules/prefer-destructuring - 'prefer-destructuring': [ - 'error', - { - VariableDeclarator: { - array: false, - object: true - }, - AssignmentExpression: { - array: true, - object: true - } - }, - { - enforceForRenamedProperties: false - } - ], - - // disallow parseInt() in favor of binary, octal, and hexadecimal literals - // https://eslint.org/docs/rules/prefer-numeric-literals - 'prefer-numeric-literals': 'error', - - // suggest using Reflect methods where applicable - // https://eslint.org/docs/rules/prefer-reflect - 'prefer-reflect': 'off', - - // use rest parameters instead of arguments - // https://eslint.org/docs/rules/prefer-rest-params - 'prefer-rest-params': 'error', - - // suggest using the spread operator instead of .apply() - // https://eslint.org/docs/rules/prefer-spread - 'prefer-spread': 'error', - - // suggest using template literals instead of string concatenation - // https://eslint.org/docs/rules/prefer-template - 'prefer-template': 'error', - - // disallow generator functions that do not have yield - // https://eslint.org/docs/rules/require-yield - 'require-yield': 'error', - - // enforce spacing between object rest-spread - // https://eslint.org/docs/rules/rest-spread-spacing - 'rest-spread-spacing': ['error', 'never'], - - // import sorting - // https://eslint.org/docs/rules/sort-imports - 'sort-imports': [ - 'off', - { - ignoreCase: false, - ignoreMemberSort: false, - memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'] - } - ], - - // require a Symbol description - // https://eslint.org/docs/rules/symbol-description - 'symbol-description': 'error', - - // enforce usage of spacing in template strings - // https://eslint.org/docs/rules/template-curly-spacing - 'template-curly-spacing': 'error', - - // enforce spacing around the * in yield* expressions - // https://eslint.org/docs/rules/yield-star-spacing - 'yield-star-spacing': ['error', 'after'] - } -}; +// ECMAScript 6, https://eslint.org/docs/rules/#ecmascript-6 +module.exports = {}; diff --git a/packages/eslint-config/rules/index.js b/packages/eslint-config/rules/index.js index babc53c..bded8c0 100644 --- a/packages/eslint-config/rules/index.js +++ b/packages/eslint-config/rules/index.js @@ -1,10 +1,14 @@ -// rules 里面是符合 eslint 的一些推荐规则,基于 airbnb +'use strict'; + +// 基于 eslint:recommend, 自定义的规则按类别维护 module.exports = { extends: [ + './recommend', './best-practices', './errors', './es6', './style', './variables' - ].map(require.resolve) + ].map(require.resolve), + rules: {} }; diff --git a/packages/eslint-config/rules/recommend.js b/packages/eslint-config/rules/recommend.js new file mode 100644 index 0000000..106e450 --- /dev/null +++ b/packages/eslint-config/rules/recommend.js @@ -0,0 +1,6 @@ +'use strict'; + +// eslint:recommended: https://eslint.org/docs/rules +module.exports = { + extends: ['eslint:recommended'] +}; diff --git a/packages/eslint-config/rules/style.js b/packages/eslint-config/rules/style.js index c46690b..8b46fbb 100644 --- a/packages/eslint-config/rules/style.js +++ b/packages/eslint-config/rules/style.js @@ -1,566 +1,3 @@ -module.exports = { - rules: { - // enforce line breaks after opening and before closing array brackets - // https://eslint.org/docs/rules/array-bracket-newline - // TODO: enable? semver-major - 'array-bracket-newline': ['off', 'consistent'], // object option alternative: { multiline: true, minItems: 3 } +'use strict'; - // enforce line breaks between array elements - // https://eslint.org/docs/rules/array-element-newline - // TODO: enable? semver-major - 'array-element-newline': ['off', { multiline: true, minItems: 3 }], - - // enforce spacing inside array brackets - 'array-bracket-spacing': ['error', 'never'], - - // enforce spacing inside single-line blocks - // https://eslint.org/docs/rules/block-spacing - 'block-spacing': ['error', 'always'], - - // enforce one true brace style - 'brace-style': ['error', '1tbs', { allowSingleLine: true }], - - // require camel case names - camelcase: ['error', { properties: 'never' }], - - // enforce or disallow capitalization of the first letter of a comment - // https://eslint.org/docs/rules/capitalized-comments - 'capitalized-comments': [ - 'off', - 'never', - { - line: { - ignorePattern: '.*', - ignoreInlineComments: true, - ignoreConsecutiveComments: true - }, - block: { - ignorePattern: '.*', - ignoreInlineComments: true, - ignoreConsecutiveComments: true - } - } - ], - - // require trailing commas in multiline object literals - 'comma-dangle': ['error', 'never'], - - // enforce spacing before and after comma - 'comma-spacing': ['error', { before: false, after: true }], - - // enforce one true comma style - 'comma-style': [ - 'error', - 'last', - { - exceptions: { - ArrayExpression: false, - ArrayPattern: false, - ArrowFunctionExpression: false, - CallExpression: false, - FunctionDeclaration: false, - FunctionExpression: false, - ImportDeclaration: false, - ObjectExpression: false, - ObjectPattern: false, - VariableDeclaration: false, - NewExpression: false - } - } - ], - - // disallow padding inside computed properties - 'computed-property-spacing': ['error', 'never'], - - // enforces consistent naming when capturing the current execution context - 'consistent-this': 'off', - - // enforce newline at the end of file, with no multiple empty lines - 'eol-last': ['error', 'always'], - - // enforce spacing between functions and their invocations - // https://eslint.org/docs/rules/func-call-spacing - 'func-call-spacing': ['error', 'never'], - - // requires function names to match the name of the variable or property to which they are - // assigned - // https://eslint.org/docs/rules/func-name-matching - 'func-name-matching': [ - 'off', - 'always', - { - includeCommonJSModuleExports: false - } - ], - - // require function expressions to have a name - // https://eslint.org/docs/rules/func-names - 'func-names': 'warn', - - // enforces use of function declarations or expressions - // https://eslint.org/docs/rules/func-style - // TODO: enable - 'func-style': ['off', 'expression'], - - // enforce consistent line breaks inside function parentheses - // https://eslint.org/docs/rules/function-paren-newline - 'function-paren-newline': 'off', - - // Blacklist certain identifiers to prevent them being used - // https://eslint.org/docs/rules/id-blacklist - 'id-blacklist': 'off', - - // this option enforces minimum and maximum identifier lengths - // (variable names, property names etc.) - 'id-length': 'off', - - // require identifiers to match the provided regular expression - 'id-match': 'off', - - // Enforce the location of arrow function bodies with implicit returns - // https://eslint.org/docs/rules/implicit-arrow-linebreak - 'implicit-arrow-linebreak': ['error', 'beside'], - - // this option sets a specific tab width for your code - // https://eslint.org/docs/rules/indent - indent: [ - 'error', - 2, - { - SwitchCase: 1, - VariableDeclarator: 1, - outerIIFEBody: 1, - // MemberExpression: null, - FunctionDeclaration: { - parameters: 1, - body: 1 - }, - FunctionExpression: { - parameters: 1, - body: 1 - }, - CallExpression: { - arguments: 1 - }, - ArrayExpression: 1, - ObjectExpression: 1, - ImportDeclaration: 1, - flatTernaryExpressions: false, - // list derived from https://github.com/benjamn/ast-types/blob/HEAD/def/jsx.js - ignoredNodes: [ - 'JSXElement', - 'JSXElement > *', - 'JSXAttribute', - 'JSXIdentifier', - 'JSXNamespacedName', - 'JSXMemberExpression', - 'JSXSpreadAttribute', - 'JSXExpressionContainer', - 'JSXOpeningElement', - 'JSXClosingElement', - 'JSXText', - 'JSXEmptyExpression', - 'JSXSpreadChild' - ], - ignoreComments: false - } - ], - - // specify whether double or single quotes should be used in JSX attributes - // https://eslint.org/docs/rules/jsx-quotes - 'jsx-quotes': ['off', 'prefer-double'], - - // enforces spacing between keys and values in object literal properties - 'key-spacing': ['error', { beforeColon: false, afterColon: true }], - - // require a space before & after certain keywords - 'keyword-spacing': [ - 'error', - { - before: true, - after: true, - overrides: { - return: { after: true }, - throw: { after: true }, - case: { after: true } - } - } - ], - - // enforce position of line comments - // https://eslint.org/docs/rules/line-comment-position - // TODO: enable? - 'line-comment-position': [ - 'off', - { - position: 'above', - ignorePattern: '', - applyDefaultPatterns: true - } - ], - - // disallow mixed 'LF' and 'CRLF' as linebreaks - // https://eslint.org/docs/rules/linebreak-style - 'linebreak-style': ['error', 'unix'], - - // require or disallow an empty line between class members - // https://eslint.org/docs/rules/lines-between-class-members - 'lines-between-class-members': [ - 'error', - 'always', - { exceptAfterSingleLine: false } - ], - - // enforces empty lines around comments - 'lines-around-comment': 'off', - - // require or disallow newlines around directives - // https://eslint.org/docs/rules/lines-around-directive - 'lines-around-directive': [ - 'error', - { - before: 'always', - after: 'always' - } - ], - - // specify the maximum depth that blocks can be nested - 'max-depth': ['off', 4], - - // specify the maximum length of a line in your program - // https://eslint.org/docs/rules/max-len - 'max-len': [ - 'error', - 100, - 2, - { - ignoreUrls: true, - ignoreComments: false, - ignoreRegExpLiterals: true, - ignoreStrings: true, - ignoreTemplateLiterals: true - } - ], - - // specify the max number of lines in a file - // https://eslint.org/docs/rules/max-lines - 'max-lines': [ - 'off', - { - max: 300, - skipBlankLines: true, - skipComments: true - } - ], - - // specify the maximum depth callbacks can be nested - 'max-nested-callbacks': 'off', - - // limits the number of parameters that can be used in the function declaration. - 'max-params': ['off', 3], - - // specify the maximum number of statement allowed in a function - 'max-statements': ['off', 10], - - // restrict the number of statements per line - // https://eslint.org/docs/rules/max-statements-per-line - 'max-statements-per-line': ['off', { max: 1 }], - - // enforce a particular style for multiline comments - // https://eslint.org/docs/rules/multiline-comment-style - 'multiline-comment-style': ['off', 'starred-block'], - - // require multiline ternary - // https://eslint.org/docs/rules/multiline-ternary - // TODO: enable? - 'multiline-ternary': ['off', 'never'], - - // require a capital letter for constructors - 'new-cap': [ - 'error', - { - newIsCap: true, - newIsCapExceptions: [], - capIsNew: false, - capIsNewExceptions: ['Immutable.Map', 'Immutable.Set', 'Immutable.List'] - } - ], - - // disallow the omission of parentheses when invoking a constructor with no arguments - // https://eslint.org/docs/rules/new-parens - 'new-parens': 'error', - - // allow/disallow an empty newline after var statement - 'newline-after-var': 'off', - - // https://eslint.org/docs/rules/newline-before-return - 'newline-before-return': 'off', - - // enforces new line after each method call in the chain to make it - // more readable and easy to maintain - // https://eslint.org/docs/rules/newline-per-chained-call - 'newline-per-chained-call': ['error', { ignoreChainWithDepth: 4 }], - - // disallow use of the Array constructor - 'no-array-constructor': 'error', - - // disallow use of bitwise operators - // https://eslint.org/docs/rules/no-bitwise - 'no-bitwise': 'error', - - // disallow use of the continue statement - // https://eslint.org/docs/rules/no-continue - 'no-continue': 'error', - - // disallow comments inline after code - 'no-inline-comments': 'off', - - // disallow if as the only statement in an else block - // https://eslint.org/docs/rules/no-lonely-if - 'no-lonely-if': 'error', - - // disallow un-paren'd mixes of different operators - // https://eslint.org/docs/rules/no-mixed-operators - 'no-mixed-operators': 'off', - - // disallow mixed spaces and tabs for indentation - 'no-mixed-spaces-and-tabs': 'error', - - // disallow use of chained assignment expressions - // https://eslint.org/docs/rules/no-multi-assign - 'no-multi-assign': ['error'], - - // disallow multiple empty lines and only one newline at the end - 'no-multiple-empty-lines': ['error', { max: 2, maxEOF: 1 }], - - // disallow negated conditions - // https://eslint.org/docs/rules/no-negated-condition - 'no-negated-condition': 'off', - - // disallow nested ternary expressions - 'no-nested-ternary': 'error', - - // disallow use of the Object constructor - 'no-new-object': 'error', - - // disallow use of unary operators, ++ and -- - // https://eslint.org/docs/rules/no-plusplus - 'no-plusplus': 'error', - - // disallow certain syntax forms - // https://eslint.org/docs/rules/no-restricted-syntax - 'no-restricted-syntax': [ - 'error', - { - selector: 'ForInStatement', - message: - 'for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.' - }, - { - selector: 'ForOfStatement', - message: - 'iterators/generators require regenerator-runtime, which is too heavyweight for this guide to allow them. Separately, loops should be avoided in favor of array iterations.' - }, - { - selector: 'LabeledStatement', - message: - 'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.' - }, - { - selector: 'WithStatement', - message: - '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.' - } - ], - - // disallow space between function identifier and application - 'no-spaced-func': 'error', - - // disallow tab characters entirely - 'no-tabs': 'error', - - // disallow the use of ternary operators - 'no-ternary': 'off', - - // disallow trailing whitespace at the end of lines - 'no-trailing-spaces': [ - 'error', - { - skipBlankLines: false, - ignoreComments: false - } - ], - - // disallow dangling underscores in identifiers - 'no-underscore-dangle': 'off', - - // disallow the use of Boolean literals in conditional expressions - // also, prefer `a || b` over `a ? a : b` - // https://eslint.org/docs/rules/no-unneeded-ternary - 'no-unneeded-ternary': ['error', { defaultAssignment: false }], - - // disallow whitespace before properties - // https://eslint.org/docs/rules/no-whitespace-before-property - 'no-whitespace-before-property': 'error', - - // enforce the location of single-line statements - // https://eslint.org/docs/rules/nonblock-statement-body-position - 'nonblock-statement-body-position': ['error', 'beside', { overrides: {} }], - - // require padding inside curly braces - 'object-curly-spacing': ['error', 'always'], - - // enforce line breaks between braces - // https://eslint.org/docs/rules/object-curly-newline - 'object-curly-newline': [ - 'error', - { - ObjectExpression: { - minProperties: 4, - multiline: true, - consistent: true - }, - ObjectPattern: { minProperties: 4, multiline: true, consistent: true }, - ImportDeclaration: { - minProperties: 4, - multiline: true, - consistent: true - }, - ExportDeclaration: { - minProperties: 4, - multiline: true, - consistent: true - } - } - ], - - // enforce "same line" or "multiple line" on object properties. - // https://eslint.org/docs/rules/object-property-newline - 'object-property-newline': [ - 'error', - { - allowAllPropertiesOnSameLine: true - } - ], - - // allow just one var statement per function - 'one-var': ['error', 'never'], - - // require a newline around variable declaration - // https://eslint.org/docs/rules/one-var-declaration-per-line - 'one-var-declaration-per-line': ['error', 'always'], - - // require assignment operator shorthand where possible or prohibit it entirely - // https://eslint.org/docs/rules/operator-assignment - 'operator-assignment': ['error', 'always'], - - // Requires operator at the beginning of the line in multiline statements - // https://eslint.org/docs/rules/operator-linebreak - 'operator-linebreak': ['error', 'before', { overrides: { '=': 'none' } }], - - // disallow padding within blocks - 'padded-blocks': [ - 'error', - { blocks: 'never', classes: 'never', switches: 'never' } - ], - - // Require or disallow padding lines between statements - // https://eslint.org/docs/rules/padding-line-between-statements - 'padding-line-between-statements': 'off', - - // require quotes around object literal property names - // https://eslint.org/docs/rules/quote-props.html - 'quote-props': [ - 'error', - 'as-needed', - { keywords: false, unnecessary: true, numbers: false } - ], - - // specify whether double or single quotes should be used - quotes: ['error', 'single', { avoidEscape: true }], - - // do not require jsdoc - // https://eslint.org/docs/rules/require-jsdoc - 'require-jsdoc': 'off', - - // require or disallow use of semicolons instead of ASI - semi: ['error', 'always'], - - // enforce spacing before and after semicolons - 'semi-spacing': ['error', { before: false, after: true }], - - // Enforce location of semicolons - // https://eslint.org/docs/rules/semi-style - 'semi-style': ['error', 'last'], - - // requires object keys to be sorted - 'sort-keys': ['off', 'asc', { caseSensitive: false, natural: true }], - - // sort variables within the same declaration block - 'sort-vars': 'off', - - // require or disallow space before blocks - 'space-before-blocks': 'error', - - // require or disallow space before function opening parenthesis - // https://eslint.org/docs/rules/space-before-function-paren - 'space-before-function-paren': [ - 'error', - { - anonymous: 'always', - named: 'never', - asyncArrow: 'always' - } - ], - - // require or disallow spaces inside parentheses - 'space-in-parens': ['error', 'never'], - - // require spaces around operators - 'space-infix-ops': 'error', - - // Require or disallow spaces before/after unary operators - // https://eslint.org/docs/rules/space-unary-ops - 'space-unary-ops': [ - 'error', - { - words: true, - nonwords: false, - overrides: {} - } - ], - - // require or disallow a space immediately following the // or /* in a comment - // https://eslint.org/docs/rules/spaced-comment - 'spaced-comment': [ - 'error', - 'always', - { - line: { - exceptions: ['-', '+'], - markers: ['=', '!'] // space here to support sprockets directives - }, - block: { - exceptions: ['-', '+'], - markers: ['=', '!'], // space here to support sprockets directives - balanced: true - } - } - ], - - // Enforce spacing around colons of switch statements - // https://eslint.org/docs/rules/switch-colon-spacing - 'switch-colon-spacing': ['error', { after: true, before: false }], - - // Require or disallow spacing between template tags and their literals - // https://eslint.org/docs/rules/template-tag-spacing - 'template-tag-spacing': ['error', 'never'], - - // require or disallow the Unicode Byte Order Mark - // https://eslint.org/docs/rules/unicode-bom - 'unicode-bom': ['error', 'never'], - - // require regex literals to be wrapped in parentheses - 'wrap-regex': 'off' - } -}; +module.exports = {}; diff --git a/packages/eslint-config/rules/variables.js b/packages/eslint-config/rules/variables.js index b1ea57d..8b46fbb 100644 --- a/packages/eslint-config/rules/variables.js +++ b/packages/eslint-config/rules/variables.js @@ -1,42 +1,3 @@ -module.exports = { - rules: { - // enforce or disallow variable initializations at definition - 'init-declarations': 'off', +'use strict'; - // disallow the catch clause parameter name being the same as a variable in the outer scope - 'no-catch-shadow': 'off', - - // disallow deletion of variables - 'no-delete-var': 'error', - - // disallow labels that share a name with a variable - // https://eslint.org/docs/rules/no-label-var - 'no-label-var': 'error', - - // disallow specific globals - 'no-restricted-globals': ['error', 'isFinite', 'isNaN'], - - // disallow declaration of variables already declared in the outer scope - 'no-shadow': 'error', - - // disallow shadowing of names such as arguments - 'no-shadow-restricted-names': 'error', - - // disallow use of undeclared variables unless mentioned in a /*global */ block - 'no-undef': 'error', - - // disallow use of undefined when initializing variables - 'no-undef-init': 'error', - - // disallow use of undefined variable - // https://eslint.org/docs/rules/no-undefined - // TODO: enable? - 'no-undefined': 'off', - - // disallow declaration of variables that are not used in the code - 'no-unused-vars': 'warn', - - // disallow use of variables before they are defined - 'no-use-before-define': 'off' - } -}; +module.exports = {}; diff --git a/packages/eslint-config/typescript.js b/packages/eslint-config/typescript.js index 5d6dc43..42e5b99 100644 --- a/packages/eslint-config/typescript.js +++ b/packages/eslint-config/typescript.js @@ -1,6 +1,6 @@ +'use strict'; + +// for typescript env, base on es6 env module.exports = { - extends: [ - './index', // 基于 es6 的配置 - './plugins/typescript' - ].map(require.resolve) + extends: ['./index', './plugins/typescript'].map(require.resolve) }; diff --git a/yarn.lock b/yarn.lock index 5638798..2903eb0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -769,7 +769,8 @@ write-file-atomic "^2.3.0" "@mjolnir/eslint-config@link:packages/eslint-config": - version "0.0.3" + version "0.0.0" + uid "" "@mrmlnc/readdir-enhanced@^2.2.1": version "2.2.1" @@ -859,9 +860,9 @@ integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA== "@types/node@*": - version "12.6.9" - resolved "https://registry.yarnpkg.com/@types/node/-/node-12.6.9.tgz#ffeee23afdc19ab16e979338e7b536fdebbbaeaf" - integrity sha512-+YB9FtyxXGyD54p8rXwWaN1EWEyar5L58GlGWgtH2I9rGmLGBQcw63+0jw+ujqVavNuO47S1ByAjm9zdHMnskw== + version "12.7.1" + resolved "https://registry.yarnpkg.com/@types/node/-/node-12.7.1.tgz#3b5c3a26393c19b400844ac422bd0f631a94d69d" + integrity sha512-aK9jxMypeSrhiYofWWBf/T7O+KwaiAHzM4sveCdWPn71lzUSMimRnKzhXDKfKwV1kWoBo2P1aGgaIYGLf9/ljw== "@zkochan/cmd-shim@^3.1.0": version "3.1.0" @@ -891,9 +892,9 @@ acorn-jsx@^5.0.0: integrity sha512-HJ7CfNHrfJLlNTzIEUTj43LNWGkqpRLxm3YjAlcD0ACydk9XynzYsCBHxut+iqt+1aBXkx9UP/w/ZqMr13XIzg== acorn@^6.0.7: - version "6.2.1" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.2.1.tgz#3ed8422d6dec09e6121cc7a843ca86a330a86b51" - integrity sha512-JD0xT5FCRDNyjDda3Lrg/IxFscp9q4tiYtxE1/nOzlKCk7hIRuYjhq1kCNkbPjMRMZuFq20HNQn1I9k8Oj0E+Q== + version "6.3.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.3.0.tgz#0087509119ffa4fc0a0041d1e93a417e68cb856e" + integrity sha512-/czfa8BwS88b9gWQVhc8eknunSA2DoJpJyTQkhheIf5E48u1N0R4q/YxxsAeqRrmK9TQ/uYfgLDfZo91UlANIA== agent-base@4, agent-base@^4.3.0: version "4.3.0" @@ -926,10 +927,12 @@ ajv@^6.10.0, ajv@^6.10.2, ajv@^6.5.5: json-schema-traverse "^0.4.1" uri-js "^4.2.2" -ansi-escapes@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.2.0.tgz#8780b98ff9dbf5638152d1f1fe5c1d7b4442976b" - integrity sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ== +ansi-escapes@^4.2.1: + version "4.2.1" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.2.1.tgz#4dccdb846c3eee10f6d64dea66273eab90c37228" + integrity sha512-Cg3ymMAdN10wOk/VYfLV7KCQyv7EDirJ64500sU7n9UlmioEtDuU5Gd+hj73hXSU/ex7tHJSssmyftDdkMLO8Q== + dependencies: + type-fest "^0.5.2" ansi-regex@^2.0.0: version "2.1.1" @@ -1327,12 +1330,12 @@ class-utils@^0.3.5: isobject "^3.0.0" static-extend "^0.1.1" -cli-cursor@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5" - integrity sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU= +cli-cursor@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-3.1.0.tgz#264305a7ae490d1d03bf0c9ba7c925d1753af307" + integrity sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw== dependencies: - restore-cursor "^2.0.0" + restore-cursor "^3.1.0" cli-highlight@^1.2.3: version "1.2.3" @@ -1812,6 +1815,11 @@ emoji-regex@^7.0.1: resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" integrity sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA== +emoji-regex@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" + integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== + encoding@^0.1.11: version "0.1.12" resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.12.tgz#538b66f3ee62cd1ab51ec323829d1f9480c74beb" @@ -2163,10 +2171,10 @@ figgy-pudding@^3.4.1, figgy-pudding@^3.5.1: resolved "https://registry.yarnpkg.com/figgy-pudding/-/figgy-pudding-3.5.1.tgz#862470112901c727a0e495a80744bd5baa1d6790" integrity sha512-vNKxJHTEKNThjfrdJwHc7brvM6eVevuO5nTj6ez8ZQ1qbXTvGthucRF7S4vf2cr71QVnT70V34v0S1DyQsti0w== -figures@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962" - integrity sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI= +figures@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/figures/-/figures-3.0.0.tgz#756275c964646163cc6f9197c7a0295dbfd04de9" + integrity sha512-HKri+WoWoUgr83pehn/SIgLOMZ9nAWC6dcGj26RY2R4F50u4+RTUz0RCrUlOV3nKRAICW1UGzyb+kcX2qK1S/g== dependencies: escape-string-regexp "^1.0.5" @@ -2481,9 +2489,9 @@ globby@^9.2.0: slash "^2.0.0" graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.0.tgz#8d8fdc73977cb04104721cb53666c1ca64cd328b" - integrity sha512-jpSvDPV4Cq/bgtpndIWbI5hmYxhQGHPC4d4cqBPb4DLniCfhJokdXhwhaDuLBGLQdvvRum/UiX6ECVIPvDXqdg== + version "4.2.1" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.1.tgz#1c1f0c364882c868f5bff6512146328336a11b1d" + integrity sha512-b9usnbDGnD928gJB3LrCmxoibr3VE4U2SMo5PBuBnokWyDADTqDPXg4YpwKF1trpH+UbGp7QLicO3+aWEy0+mw== handlebars@^4.1.2: version "4.1.2" @@ -2568,9 +2576,11 @@ highlight.js@^9.6.0: integrity sha512-M0zZvfLr5p0keDMCAhNBp03XJbKBxUx5AfyfufMdFMEP4N/Xj6dh0IqC75ys7BAzceR34NgcvXjupRVaHBPPVQ== hosted-git-info@^2.1.4, hosted-git-info@^2.6.0: - version "2.7.1" - resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.7.1.tgz#97f236977bd6e125408930ff6de3eec6281ec047" - integrity sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w== + version "2.8.2" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.2.tgz#a35c3f355ac1249f1093c0c2a542ace8818c171a" + integrity sha512-CyjlXII6LMsPMyUzxpTt8fzh5QwzGqPmQXgY/Jyf4Zfp27t/FvfhwoE/8laaMUcMy816CkWF20I7NeQhwwY88w== + dependencies: + lru-cache "^5.1.1" http-cache-semantics@^3.8.1: version "3.8.1" @@ -2717,21 +2727,21 @@ init-package-json@^1.10.3: validate-npm-package-name "^3.0.0" inquirer@^6.2.0, inquirer@^6.4.1: - version "6.5.0" - resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.5.0.tgz#2303317efc9a4ea7ec2e2df6f86569b734accf42" - integrity sha512-scfHejeG/lVZSpvCXpsB4j/wQNPM5JC8kiElOI0OUTwmc1RTpXr4H32/HOlQHcZiYl2z2VElwuCVDRG8vFmbnA== + version "6.5.1" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.5.1.tgz#8bfb7a5ac02dac6ff641ac4c5ff17da112fcdb42" + integrity sha512-uxNHBeQhRXIoHWTSNYUFhQVrHYFThIt6IVo2fFmSe8aBwdR3/w6b58hJpiL/fMukFkvGzjg+hSxFtwvVmKZmXw== dependencies: - ansi-escapes "^3.2.0" + ansi-escapes "^4.2.1" chalk "^2.4.2" - cli-cursor "^2.1.0" + cli-cursor "^3.1.0" cli-width "^2.0.0" external-editor "^3.0.3" - figures "^2.0.0" - lodash "^4.17.12" - mute-stream "0.0.7" + figures "^3.0.0" + lodash "^4.17.15" + mute-stream "0.0.8" run-async "^2.2.0" rxjs "^6.4.0" - string-width "^2.1.0" + string-width "^4.1.0" strip-ansi "^5.1.0" through "^2.3.6" @@ -2864,6 +2874,11 @@ is-fullwidth-code-point@^2.0.0: resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= +is-fullwidth-code-point@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" + integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== + is-glob@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-3.1.0.tgz#7ba5ae24217804ac70707b96922567486cc3e84a" @@ -3241,7 +3256,7 @@ lodash.uniq@^4.5.0: resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M= -lodash@^4.17.12, lodash@^4.17.14, lodash@^4.2.1: +lodash@^4.17.14, lodash@^4.17.15, lodash@^4.2.1: version "4.17.15" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== @@ -3440,7 +3455,7 @@ mimic-fn@^1.0.0: resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" integrity sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ== -mimic-fn@^2.0.0: +mimic-fn@^2.0.0, mimic-fn@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== @@ -3565,12 +3580,7 @@ multimatch@^3.0.0: arrify "^1.0.1" minimatch "^3.0.4" -mute-stream@0.0.7: - version "0.0.7" - resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" - integrity sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s= - -mute-stream@~0.0.4: +mute-stream@0.0.8, mute-stream@~0.0.4: version "0.0.8" resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA== @@ -3800,12 +3810,12 @@ once@^1.3.0, once@^1.3.1, once@^1.4.0: dependencies: wrappy "1" -onetime@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4" - integrity sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ= +onetime@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.0.tgz#fff0f3c91617fe62bb50189636e99ac8a6df7be5" + integrity sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q== dependencies: - mimic-fn "^1.0.0" + mimic-fn "^2.1.0" optimist@^0.6.1: version "0.6.1" @@ -4459,12 +4469,12 @@ resolve@^1.10.0, resolve@^1.10.1: dependencies: path-parse "^1.0.6" -restore-cursor@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" - integrity sha1-n37ih/gv0ybU/RYpI9YhKe7g368= +restore-cursor@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-3.1.0.tgz#39f67c54b3a7a58cea5236d95cf0034239631f7e" + integrity sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA== dependencies: - onetime "^2.0.0" + onetime "^5.1.0" signal-exit "^3.0.2" ret@~0.1.10: @@ -4505,7 +4515,7 @@ rxjs@^6.4.0: dependencies: tslib "^1.9.0" -safe-buffer@^5.0.1, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0: +safe-buffer@^5.0.1, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@~5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.0.tgz#b74daec49b1148f88c64b68d49b1e815c1f2f519" integrity sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg== @@ -4786,7 +4796,7 @@ string-width@^1.0.1: is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" -"string-width@^1.0.2 || 2", string-width@^2.0.0, string-width@^2.1.0, string-width@^2.1.1: +"string-width@^1.0.2 || 2", string-width@^2.0.0, string-width@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== @@ -4803,6 +4813,15 @@ string-width@^3.0.0: is-fullwidth-code-point "^2.0.0" strip-ansi "^5.1.0" +string-width@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.1.0.tgz#ba846d1daa97c3c596155308063e075ed1c99aff" + integrity sha512-NrX+1dVVh+6Y9dnQ19pR0pP4FiEIlUvdTGn8pw6CKTNq5sgib2nIhmUNT5TAmhWmvKr3WcxBcP3E8nWezuipuQ== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^5.2.0" + string.prototype.padend@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/string.prototype.padend/-/string.prototype.padend-3.0.0.tgz#f3aaef7c1719f170c5eab1c32bf780d96e21f2f0" @@ -4813,11 +4832,11 @@ string.prototype.padend@^3.0.0: function-bind "^1.0.2" string_decoder@^1.1.1: - version "1.2.0" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.2.0.tgz#fe86e738b19544afe70469243b2a1ee9240eae8d" - integrity sha512-6YqyX6ZWEYguAxgZzHGL7SsCeGx3V2TtOTqZz1xSTSWnqsbWwbptafNyvf/ACquZUXV3DANr5BDIwNYe1mN42w== + version "1.3.0" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" + integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== dependencies: - safe-buffer "~5.1.0" + safe-buffer "~5.2.0" string_decoder@~1.1.1: version "1.1.1" @@ -5072,6 +5091,11 @@ type-fest@^0.3.0: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.3.1.tgz#63d00d204e059474fe5e1b7c011112bbd1dc29e1" integrity sha512-cUGJnCdr4STbePCgqNFbpVNCepa+kAVohJs1sLhxzdH+gnEoOd8VhbYa7pD3zZYGiURWM2xzEII3fQcRizDkYQ== +type-fest@^0.5.2: + version "0.5.2" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.5.2.tgz#d6ef42a0356c6cd45f49485c3b6281fc148e48a2" + integrity sha512-DWkS49EQKVX//Tbupb9TFa19c7+MK1XmzkrZUR8TAktmE/DizXoaoJV6TZ/tSIPXipqNiRI6CyAe7x69Jb6RSw== + typedarray@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" @@ -5179,9 +5203,9 @@ uuid@^3.0.1, uuid@^3.3.2: integrity sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA== v8-compile-cache@^2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.0.3.tgz#00f7494d2ae2b688cfe2899df6ed2c54bef91dbe" - integrity sha512-CNmdbwQMBjwr9Gsmohvm0pbL954tJrNzf6gWL3K+QMQf00PF7ERGrEiLgjuU3mKreLC2MeGhUsNV9ybTbLgd3w== + version "2.1.0" + resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz#e14de37b31a6d194f5690d67efc4e7f6fc6ab30e" + integrity sha512-usZBT3PW+LOjM25wbqIlZwPeJV+3OSz3M1k1Ws8snlW39dZyYL9lOGC5FgPVHfk0jKmjiDV8Z0mIbVQPiwFs7g== validate-npm-package-license@^3.0.1, validate-npm-package-license@^3.0.3: version "3.0.4"