diff --git a/config/eslintrc_import.js b/config/eslintrc_import.js index 8b154886..dc44d771 100644 --- a/config/eslintrc_import.js +++ b/config/eslintrc_import.js @@ -173,6 +173,7 @@ const styleguide = { // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/order.md 'import/order': ['warn', { 'alphabetize': { + 'caseInsensitive': false, 'order': 'asc', }, 'groups': [ diff --git a/config/eslintrc_react.js b/config/eslintrc_react.js index 97c3aa30..5987220b 100644 --- a/config/eslintrc_react.js +++ b/config/eslintrc_react.js @@ -33,11 +33,16 @@ module.exports = { 'allowInPropTypes': false, // We doubt this option is really useful. }], 'react/forbid-prop-types': 0, + + // TODO(#298): This rule should be sort with project style. + 'react/function-component-definition': 0, + 'react/no-access-state-in-setstate': 1, // The index of `Array` is not suitable for `key` props. // But this restriction does not prevent that the id for each items is just a sequence number of some list // even if a item has an "unique" id. This rule cannot prevent it. meaningless. 'react/no-array-index-key': 0, + 'react/no-adjacent-inline-elements': 0, 'react/no-children-prop': 2, // children should be nested between the opening and closing tags. 'react/no-danger': 2, 'react/no-danger-with-children': 2, @@ -180,6 +185,7 @@ module.exports = { 'react/jsx-no-comment-textnodes': 2, 'react/jsx-no-duplicate-props': 2, 'react/jsx-no-literals': 1, + 'react/jsx-no-script-url': 2, 'react/jsx-no-target-blank': [1, { // see https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-target-blank.md 'enforceDynamicLinks': 'always', // For legacy browsers which does not support `rel=noopener`, this option is useful. diff --git a/config/eslintrc_typescript.js b/config/eslintrc_typescript.js index 4fd2d343..5b4fd264 100644 --- a/config/eslintrc_typescript.js +++ b/config/eslintrc_typescript.js @@ -59,6 +59,9 @@ module.exports = { // Each style has its own pros & cons. '@typescript-eslint/consistent-type-definitions': 'off', + // This avoid misusing functions + '@typescript-eslint/default-param-last': 'error', + // TODO: (#64) @typescript-eslint/explicit-function-return-type // It's redundant to enforce to supply `public`. @@ -71,6 +74,8 @@ module.exports = { }, }], + // TODO: #301 + '@typescript-eslint/explicit-module-boundary-types': 'off', // * We accept the style for T , TA , TAbc , TA1Bca , T1 , T2. // * You seem this style is similar to C# or typescript compiler. @@ -137,6 +142,8 @@ module.exports = { ], }], + // TODO(#300): '@typescript-eslint/naming-convention' + // This should be sorted with ESLint builtin rule. 'no-array-constructor': 'off', '@typescript-eslint/no-array-constructor': 'error', @@ -177,6 +184,10 @@ module.exports = { 'no-extra-parens': 'off', '@typescript-eslint/no-extra-parens': 'off', + // This should be sorted with ESLint builtin rule. + 'no-extra-semi': 'off', + '@typescript-eslint/no-extra-semi': 'warn', + // Of course, this might be redundant if you set unhandledrejection event handler. // We still have some points which should be under discussion. See: #135 '@typescript-eslint/no-floating-promises': ['warn', { @@ -187,6 +198,10 @@ module.exports = { // This is common pitfalls for beginners. We must ban. '@typescript-eslint/no-for-in-array': 'error', + // Basically, we should ban this kind of idioms. + // However, if you need to use `new Function`, then you can opt-out this rule. + '@typescript-eslint/no-implied-eval': 'error', + // Type inference is useful feature for Gradual Typing and other static typing system. // However, over omission would increases compile (type checking) time and // lacks the aspect of type annotation benefits as _documentation_. @@ -221,6 +236,9 @@ module.exports = { 'allowDefinitionFiles': true, }], + // Ban this pattern to keep type safety + '@typescript-eslint/no-non-null-asserted-optional-chain': 'error', + // Please opt-out this rule if you don't have any workarounds. '@typescript-eslint/no-non-null-assertion': 'warn', @@ -242,6 +260,9 @@ module.exports = { 'allowedNames': ['self'], }], + // Should throw only Error or derived classes. + '@typescript-eslint/no-throw-literal': 'error', + // Disabling this does not make sense completely. '@typescript-eslint/no-type-alias': 'off', @@ -249,6 +270,8 @@ module.exports = { '@typescript-eslint/no-unnecessary-condition': ['warn', { 'ignoreRhs': false, 'allowConstantLoopConditions': true, + // FIXME: #299 + 'checkArrayPredicates': false, }], // Try to detect redundant case,