Releases: Shopify/eslint-plugin-shopify
v33.0.0
Breaking Change
- The
graphql
configs have been pushed to anoverride
for files matching a.graphql
extension. This will allow this config to chain together with other parser-setting configs without changing the parser value. Consider the following config:
// .eslintrc
{
extends: [
"plugin:shopify/typescript",
"plugin:shopify/graphql"
]
}
Before this change the final parser becomes babel-eslint
for all files. This will cause errors when parsing TypeScript files even though we are extending the typescript config :( You could workaround this by moving the plugin:shopify/graphql
first in the extends array or lint GraphQL files in a seperate script.
After this change Final parser is babel-eslint
for only .graphql
files while @typescript-eslint/parser
is set for all .ts
and .tsx
files. This should not cause any parser-related errors :)
New Rules
v31.0.0
Typescript Parser Changes
- Breaking Change Updated from
eslint-plugin-typescript
to@typescript-eslint/eslint-plugin
. If you have any rules defined under the typescript namespace, you will need to change those to use the new@typescript-eslint
namespace.
For example:
"rules": {
"typescript/restrict-plus-operands": "error"
}
Will become:
"rules": {
"@typescript-eslint/restrict-plus-operands": "error"
}
- Note If using the
plugin:shopify/typescript-type-checking
augmented config, you must specify a path to your tsconfig.json file in the "project" property of "parserOptions"
React Config Changes
- Breaking Change The
plugin:shopify/react
is no longer a core config and must augment one of theplugin:shopify/typescript
orplugin:shopify/esnext
configs. See examples below
Example config for react without typescript projects:
{
"extends": [
"plugin:shopify/esnext",
"plugin:shopify/react",
"// ...other plugins"
]
}
Example config for react with typescript projects:
{
"extends": [
"plugin:shopify/typescript",
"plugin:shopify/react",
"// ...other plugins"
]
}
New Rules
jest/no-standalone-expect
Preventsexpect
statements outside of atest
orit
block (368)jest/no-expect-resolves
Avoid usingexpect().resolves
(370)
Dependencies
- As of this version, you will need to be upgrade to
eslint@^6.0.0
within your project.
v30.0.0
Changes
- Changed
typescript/interface-name-prefix
to preventI
prefixes in TypeScript interface names - Enabled
jest/no-duplicate-hooks
- Enabled
jest/no-export
- Enabled
no-async-promise-executor
- Removed
shopify/jest/no-try-expect
we now usejest/no-try-expect
instead - Removed
shopify/jest/no-if
we now usejest/no-if
instead
v29.0.2
v29.0.1
v29.0.0
Added Rules
jest/no-commented-out-tests
disallows commented out tests.(275)jest/no-try-expect
disallowsexpect
calls incatch
blocks (300)node/prefer-promises/dns
andnode/prefer-promises/fs
These rules disallow the callback API in favor of promise API for the dns and fs modules. (257)jest/no-mocks-import
This rule disallows manually importing from__mocks__
(246)react/state-in-constructor
Enforce state initialization to be in a class property. (256)import/no-namespace
Prevents namespace imports. (305)
Changed Rules
shopify/jest/no-vague-titles
considers "necessary" to be invalid/ vague (265)shopify/jest/no-if
now recognizes conditional statements (298) and ignores if statements nested within block statements (299)react-prefer-private-members
no longer incorrectly reporting the members of a parent class if a React class is defined within its constructor. (258)
v27.0.0
Breaking Changes
-
shopify/jquery-dollar-sign-reference
has been removed. -
The
eslint-comments
ruleset has been removed and is now enabled by default as part of core - if you're usinges5
,esnext
,react
ortypescript
then you can remove the reference toeslint-comments
. -
The
ava
,mocha
,jquery
andlodash
rulesets have been removed as these tools are are not commonly used at Shopify. -
The
typescript-react
andtypescript-prettier
rulesets have been removed. Replace["plugin:shopify/typescript-react"]
with["plugin:shopify/typescript", "plugin:shopify/react"]
and replace["plugin:shopify/typescript-prettier"]
with["plugin:shopify/prettier"]
-
Updated from
eslint-plugin-typescript
to@typescript-eslint/eslint-plugin
. If you have any rules defined under thetypescript
namespace, you will need to change those to use the new@typescript-eslint
namespace.For example:
"rules": { "typescript/restrict-plus-operands": "error" }
Will become:
"rules": { "@typescript-eslint/restrict-plus-operands": "error" }
More information on this change can be found in this eslint blog post.
New rules
shopify/jest/no-if
(#232)
Refer to the Rules of Hooks documentation to learn more about the following rules.
'react-hooks/rules-of-hooks': 'error'
'react-hooks/exhaustive-deps': 'error'
Changed rules
jest/no-vague-titles
addedevery
anddescriptive
as vague words. (#221)
v23.0.0
Added
shopify/jsx-prefer-fragment-wrappers
(#94)shopify/jest/no-vague-titles
(#93)shopify/strict-component-boundaries
(#98)shopify/prefer-pascal-case-enums
(#96)shopify/react-prefer-private-members
(#95)
Changed
- Breaking Moved prettier to be a peerDependency, this avoids the potential for having multiple versions of prettier in the dependency graph. If you use prettier you will need to ensure you have it installed in your project as eslint-plugin-shopify will no longer install it for you (#107)
- Breaking Updated
typescript-eslint-parser
to supporttypescript@2.9.1
(#102) - Updated
eslint-plugin-sort-class-members
dependency to version 1.3.1 in order to support node 10. - Support for TypeScript 2.8
- Fixed the publish config for the package.
v20.0.0 - TypeScript 2.7 support
- Breaking: the version of TypeScript supported by this plugin is 2.7.x (in line with typescript-eslint-parser’s TypeScript support)
- Updated dependencies that support the new ESLint documentation URL metadata. Errors from these plugins are accompanied by a link to the documentation for the broken rule.
- Dependencies are now strictly versioned for tighter control over the exact rules the plugin enforces.
Package | old | new |
---|---|---|
eslint-plugin-ava |
^4.4.0 |
4.5.1 |
eslint-plugin-import |
^2.8.0 |
2.9.0 |
eslint-plugin-jest |
^21.5.0 |
21.14.1 |
eslint-plugin-lodash |
^2.5.0 |
2.6.1 |
eslint-plugin-node |
^5.2.1 |
6.0.1 |
eslint-plugin-prettier |
^2.4.0 |
2.6.0 |
eslint-plugin-promise |
^3.6.0 |
3.7.0 |
eslint-plugin-react |
^7.5.1 |
7.7.0 |
eslint-plugin-typescript |
^0.8.1 |
0.10.0 |
- Added rules:
react/forbid-dom-props
(disabled)react/jsx-child-element-spacing
errorreact/jsx-max-depth
(disabled)react/jsx-sort-default-props
(disabled)react/no-this-in-sfc
errorimport/group-exports
(disabled)import/no-self-import
errorimport/no-default-export
(disabled)import/no-useless-path-segments
errorjest/prefer-expect-assertions
(disabled)jest/valid-expect-in-promise
errorjest/valid-describe
errorjest/consistent-test-it
errorjest/no-test-prefixes
errorjest/lowercase-name
(disabled)jest/no-jest-import
errorpromise/valid-params
errorpromise/no-new-statics
(disabled)typescript/explicit-function-return-type
(disabled)typescript/no-non-null-assertion
error
- Updated
import/extensions
due to changes in its implementation: some extensions are explicitly allowed inimport
s:.svg
,.png
,.jpg
,.ico
,.css
,.sass
,.scss
,.less
,.styl
..json
is still required as well. - Chore: updated CircleCI from v1 to v2.