Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump eslint plugins #179

Merged
merged 8 commits into from Sep 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 7 additions & 3 deletions packages/eslint-plugin/lib/config/rules/jest.js
Expand Up @@ -13,6 +13,8 @@ module.exports = {
'jest/no-jasmine-globals': 'error',
// Limited snapshot sizes to keep snapshops manageable and reviewable.
'jest/no-large-snapshots': ['error', {maxSize: 12}],
// Disallow interpolation in snapshots to ensure they can be automatically updated.
'jest/no-interpolation-in-snapshots': 'error',
// For better failure messages, use `toHaveLength()` to on object lengths.
'jest/prefer-to-have-length': 'error',
// Suggest using toMatchInlineSnapshot()
Expand Down Expand Up @@ -44,7 +46,7 @@ module.exports = {
// Disallow setup and teardown hooks
'jest/no-hooks': 'off',
// Using a callback in asynchronous tests
'jest/no-test-callback': 'error',
'jest/no-done-callback': 'error',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jest/no-try-expect is deprecated in favor of jest/no-conditional-expect

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add those new rules

  • jest/no-interpolation-in-snapshots
  • jest/no-deprecated-functions

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They seem reasonable, good spot

// Disallow using toBeTruthy() & toBeFalsy()
'jest/no-truthy-falsy': 'error',
// Suggest using toBeCalledWith() OR toHaveBeenCalledWith()
Expand All @@ -67,8 +69,8 @@ module.exports = {
'jest/no-duplicate-hooks': 'error',
// Disallow conditional logic
'jest/no-if': 'error',
// Prevent assertions in catch blocks.
'jest/no-try-expect': 'error',
// Prevent assertions that are conditional.
'jest/no-conditional-expect': 'error',
// Disallow export from test files
'jest/no-export': 'error',
// Prevents `expect` statements outside of a `test` or `it` block
Expand All @@ -81,4 +83,6 @@ module.exports = {
'jest/prefer-hooks-on-top': 'error',
// Require top-level describe block
'jest/require-top-level-describe': 'error',
// Avoid using deprecated functions
'jest/no-deprecated-functions': 'error',
};
2 changes: 1 addition & 1 deletion packages/eslint-plugin/lib/config/rules/typescript.js
Expand Up @@ -156,7 +156,7 @@ module.exports = {
'@typescript-eslint/prefer-function-type': 'off',
// Functions that return promises must be async
'@typescript-eslint/promise-function-async': 'off',
// Bans “// @ts-ignore” comments from being used
// Bans “// @ts-ignore” comments from being used. "@ts-expect-error: some comment describing why it's disabled" is allowed
'@typescript-eslint/ban-ts-comment': 'error',
// Enforce consistent brace style for blocks
'@typescript-eslint/brace-style': 'error',
Expand Down
Expand Up @@ -34,10 +34,7 @@ module.exports = {
// When adding two variables, operands must both be of type number or of type string
'@typescript-eslint/restrict-plus-operands': 'error',
// Prevents conditionals where the type is always truthy or always falsy
'@typescript-eslint/no-unnecessary-condition': [
'error',
{ignoreRhs: true},
],
'@typescript-eslint/no-unnecessary-condition': ['error'],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ignoreRhs was removed

// Warns if an explicitly specified type argument is the default for that type parameter
'@typescript-eslint/no-unnecessary-type-arguments': 'error',
// Requires that private members are marked as readonly if they're never modified outside of the constructor
Expand Down
24 changes: 12 additions & 12 deletions packages/eslint-plugin/package.json
@@ -1,6 +1,6 @@
{
"name": "@shopify/eslint-plugin",
"version": "38.0.0",
"version": "38.1.0-beta.3",
"license": "MIT",
"description": "Shopify’s ESLint rules and configs.",
"keywords": [
Expand Down Expand Up @@ -33,26 +33,26 @@
"eslint": "^6.0.0"
},
"dependencies": {
"@typescript-eslint/eslint-plugin": "^3.9.1",
"@typescript-eslint/parser": "^3.9.1",
"@typescript-eslint/eslint-plugin": "^4.1.0",
"@typescript-eslint/parser": "^4.1.0",
"babel-eslint": "10.1.0",
"change-case": "^4.1.1",
"common-tags": "^1.8.0",
"eslint-config-prettier": "6.11.0",
"eslint-module-utils": "2.6.0",
"eslint-plugin-babel": "5.3.0",
"eslint-plugin-eslint-comments": "3.1.2",
"eslint-plugin-graphql": "3.1.1",
"eslint-plugin-babel": "5.3.1",
"eslint-plugin-eslint-comments": "3.2.0",
"eslint-plugin-graphql": "4.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just double-checking, this version only supports Node.js 10.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This plugin only supports node 10 since we moved to typescript-eslint/eslint-plugin v3 (which dropped support for node 8) so this doesn't affect our version support :)

"eslint-plugin-import": "2.22.0",
"eslint-plugin-jest": "23.13.0",
"eslint-plugin-jest": "24.0.0",
"eslint-plugin-jest-formatting": "2.0.0",
"eslint-plugin-jsx-a11y": "6.2.3",
"eslint-plugin-jsx-a11y": "6.3.1",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-prettier": "3.1.3",
"eslint-plugin-prettier": "3.1.4",
"eslint-plugin-promise": "4.2.1",
"eslint-plugin-react": "7.20.0",
"eslint-plugin-react-hooks": "4.0.2",
"eslint-plugin-sort-class-members": "1.7.0",
"eslint-plugin-react": "7.20.6",
"eslint-plugin-react-hooks": "4.1.1",
"eslint-plugin-sort-class-members": "1.8.0",
"merge": "^1.2.1",
"pkg-dir": "^4.2.0",
"pluralize": "^8.0.0"
Expand Down