Skip to content

Commit

Permalink
feat: turning on jest/require-tothrow-message (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
erunion authored Nov 26, 2019
1 parent 5c22721 commit 7e3f20e
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 93 deletions.
3 changes: 3 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "./index.js"
}
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"printWidth": 120,
"singleQuote": true,
"trailingComma": "es5"
}
91 changes: 44 additions & 47 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,68 +1,65 @@
module.exports = {
extends: [
"airbnb-base",
"eslint:recommended",
"plugin:eslint-comments/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:sonarjs/recommended",
"prettier"
'airbnb-base',
'eslint:recommended',
'plugin:eslint-comments/recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:sonarjs/recommended',
'prettier',
],
plugins: ["node", "prettier", "unicorn"],
plugins: ['node', 'prettier', 'unicorn'],
rules: {
"arrow-body-style": "off",
'arrow-body-style': 'off',

"eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }],
"eslint-comments/no-unused-disable": "error",
'eslint-comments/disable-enable-pair': ['error', { allowWholeFile: true }],
'eslint-comments/no-unused-disable': 'error',

"func-names": "off",
'func-names': 'off',

"import/default": "off",
"import/named": "off", // @fixme Disabling this for now, but there are some weird callouts with it.
"import/order": "off",
'import/default': 'off',
'import/named': 'off', // @fixme Disabling this for now, but there are some weird callouts with it.
'import/order': 'off',

"no-constructor-return": "error",
"no-dupe-else-if": "error",
"no-else-return": ["error", { allowElseIf: true }],
'no-constructor-return': 'error',
'no-dupe-else-if': 'error',
'no-else-return': ['error', { allowElseIf: true }],

// Disallow shadowing of any variable that isn't "err" as this is a common case that is acceptable.
"no-shadow": ["error", { allow: ["err"] }],
'no-shadow': ['error', { allow: ['err'] }],

"node/no-deprecated-api": "error",
"node/no-exports-assign": "error",
"node/no-extraneous-require": "error",
'node/no-deprecated-api': 'error',
'node/no-exports-assign': 'error',
'node/no-extraneous-require': 'error',

"prefer-destructuring": "off",
'prefer-destructuring': 'off',

"prettier/prettier": "error",
'prettier/prettier': 'error',

"sonarjs/cognitive-complexity": "off",
"sonarjs/no-collapsible-if": "off",
"sonarjs/no-duplicate-string": "off",
"sonarjs/no-duplicated-branches": "off",
"sonarjs/no-identical-functions": "off", // @todo We should fix these.
"sonarjs/prefer-immediate-return": "off", // @todo We should fix these.
'sonarjs/cognitive-complexity': 'off',
'sonarjs/no-collapsible-if': 'off',
'sonarjs/no-duplicate-string': 'off',
'sonarjs/no-duplicated-branches': 'off',
'sonarjs/no-identical-functions': 'off', // @todo We should fix these.
'sonarjs/prefer-immediate-return': 'off', // @todo We should fix these.

"unicorn/catch-error-name": [
"error",
{ caughtErrorsIgnorePattern: "^(error|err|e)$" }
],
'unicorn/catch-error-name': ['error', { caughtErrorsIgnorePattern: '^(error|err|e)$' }],
// "unicorn/consistent-function-scoping": "error", // Maybe?
"unicorn/custom-error-definition": "error",
"unicorn/error-message": "error",
"unicorn/escape-case": "error",
"unicorn/new-for-builtins": "error",
"unicorn/no-array-instanceof": "error",
'unicorn/custom-error-definition': 'error',
'unicorn/error-message': 'error',
'unicorn/escape-case': 'error',
'unicorn/new-for-builtins': 'error',
'unicorn/no-array-instanceof': 'error',
// "unicorn/no-for-loop": "error", // Maybe?
"no-nested-ternary": "off", // Disabled in favor of `unicorn/no-nested-ternary` which has better nesting detection.
"unicorn/no-nested-ternary": "error",
"unicorn/no-unreadable-array-destructuring": "error",
'no-nested-ternary': 'off', // Disabled in favor of `unicorn/no-nested-ternary` which has better nesting detection.
'unicorn/no-nested-ternary': 'error',
'unicorn/no-unreadable-array-destructuring': 'error',
// "unicorn/no-unsafe-regex": "error", // @todo We should resolve these.
"unicorn/no-unused-properties": "error",
'unicorn/no-unused-properties': 'error',
// "unicorn/prefer-includes": "error", // Maybe?
// "unicorn/prefer-query-selector": "error", // Maybe?
"unicorn/prefer-starts-ends-with": "off", // @todo We should resolve these.
"unicorn/prefer-type-error": "error",
"unicorn/throw-new-error": "error"
}
'unicorn/prefer-starts-ends-with': 'off', // @todo We should resolve these.
'unicorn/prefer-type-error': 'error',
'unicorn/throw-new-error': 'error',
},
};
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,5 @@
"extends": [
"@commitlint/config-conventional"
]
},
"eslintConfig": {
"extends": "./index.js"
}
}
49 changes: 23 additions & 26 deletions react.js
Original file line number Diff line number Diff line change
@@ -1,43 +1,40 @@
module.exports = {
extends: ["plugin:jsx-a11y/recommended", "plugin:react/recommended"],
extends: ['plugin:jsx-a11y/recommended', 'plugin:react/recommended'],
env: {
browser: true
browser: true,
},
settings: {
"import/resolver": {
'import/resolver': {
node: {
extensions: [".js", ".jsx"]
}
extensions: ['.js', '.jsx'],
},
},
react: {
version: "detect"
}
version: 'detect',
},
},
rules: {
"jsx-a11y/no-onchange": "off", // @todo We should fix these.
'jsx-a11y/no-onchange': 'off', // @todo We should fix these.

"no-param-reassign": ["error", { props: false }],
'no-param-reassign': ['error', { props: false }],

"react/destructuring-assignment": "off",
"react/jsx-props-no-spreading": [
"error",
'react/destructuring-assignment': 'off',
'react/jsx-props-no-spreading': [
'error',
{
html: "enforce",
custom: "ignore"
}
html: 'enforce',
custom: 'ignore',
},
],

"react/jsx-sort-default-props": ["error", { ignoreCase: true }],
"react/jsx-sort-props": [
"error",
{ ignoreCase: true, reservedFirst: true }
],
"react/sort-prop-types": [
"error",
'react/jsx-sort-default-props': ['error', { ignoreCase: true }],
'react/jsx-sort-props': ['error', { ignoreCase: true, reservedFirst: true }],
'react/sort-prop-types': [
'error',
{
ignoreCase: true,
sortShapeProp: true
}
]
}
sortShapeProp: true,
},
],
},
};
35 changes: 18 additions & 17 deletions testing.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
module.exports = {
extends: ["plugin:jest/recommended", "plugin:jest/style"],
plugins: ["jest"],
extends: ['plugin:jest/recommended', 'plugin:jest/style'],
plugins: ['jest'],
env: {
"jest/globals": true
'jest/globals': true,
},
rules: {
"jest/consistent-test-it": "warn",
"jest/expect-expect": "warn",
"jest/no-disabled-tests": "off",
"jest/no-duplicate-hooks": "warn",
"jest/no-expect-resolves": "warn",
"jest/no-if": "error",
"jest/prefer-hooks-on-top": "warn",
"jest/prefer-strict-equal": "error",
"jest/valid-describe": "error",
"jest/valid-title": "warn",
'jest/consistent-test-it': 'warn',
'jest/expect-expect': 'warn',
'jest/no-disabled-tests': 'off',
'jest/no-duplicate-hooks': 'warn',
'jest/no-expect-resolves': 'warn',
'jest/no-if': 'error',
'jest/prefer-hooks-on-top': 'warn',
'jest/prefer-strict-equal': 'error',
'jest/require-tothrow-message': 'error',
'jest/valid-describe': 'error',
'jest/valid-title': 'warn',

"import/no-extraneous-dependencies": "off",
"node/no-extraneous-require": "off",
'import/no-extraneous-dependencies': 'off',
'node/no-extraneous-require': 'off',

"sonarjs/no-identical-functions": "off"
}
'sonarjs/no-identical-functions': 'off',
},
};

0 comments on commit 7e3f20e

Please sign in to comment.