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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support ESLint 8.x #465

Merged
merged 4 commits into from Oct 17, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 5 additions & 1 deletion .eslintrc.json
Expand Up @@ -6,7 +6,11 @@
"jest/globals": true
},
"extends": [
"kentcdodds",
/** Temporary disable eslint-config-kentcdodds until it supports ESLint v8
* This package is a dependency of eslint-config-kentcdodds, so because it's
* a devDependency to our package, we need to support ESLint v8 first.
*/
// 'kentcdodds',
Copy link
Member

Choose a reason for hiding this comment

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

Ok so rather than this, since other plugins are failing with ESLint v8 too, it would be better to stick to ESLint v7 in our dev dependencies so we don't block the release of our v5 for some dev dependencies.

Let's downgrade ESLint to v7 in our dev dependencies then, re-enable kentcdodds plugin, and move the list of pending plugins to be compatible with ESLint v8 to a separate issue so when all are ready we can upgrade to v8 in our dev dependencies.

"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pipeline.yml
Expand Up @@ -52,7 +52,7 @@ jobs:
strategy:
matrix:
node: [12.22.0, 12, 14.17.0, 14, '16.0', 16]
eslint: [7.5, 7]
eslint: [7.5, 7, 8]
Copy link
Member

Choose a reason for hiding this comment

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

By running this we make sure our plugin works for both ESLint v7 and v8 even if we use v7 in dev dependencies.


steps:
- name: Cancel Previous Runs
Expand Down
1 change: 0 additions & 1 deletion lib/rules/await-async-query.ts
Expand Up @@ -20,7 +20,6 @@ export default createTestingLibraryRule<Options, MessageIds>({
type: 'problem',
docs: {
description: 'Enforce promises from async queries to be handled',
category: 'Best Practices',
recommendedConfig: {
dom: 'error',
angular: 'error',
Expand Down
1 change: 0 additions & 1 deletion lib/rules/await-async-utils.ts
Expand Up @@ -19,7 +19,6 @@ export default createTestingLibraryRule<Options, MessageIds>({
type: 'problem',
docs: {
description: 'Enforce promises from async utils to be awaited properly',
category: 'Best Practices',
recommendedConfig: {
dom: 'error',
angular: 'error',
Expand Down
1 change: 0 additions & 1 deletion lib/rules/await-fire-event.ts
Expand Up @@ -19,7 +19,6 @@ export default createTestingLibraryRule<Options, MessageIds>({
type: 'problem',
docs: {
description: 'Enforce promises from `fireEvent` methods to be handled',
category: 'Best Practices',
recommendedConfig: {
dom: false,
angular: false,
Expand Down
1 change: 0 additions & 1 deletion lib/rules/consistent-data-testid.ts
Expand Up @@ -18,7 +18,6 @@ export default createTestingLibraryRule<Options, MessageIds>({
type: 'suggestion',
docs: {
description: 'Ensures consistent usage of `data-testid`',
category: 'Best Practices',
recommendedConfig: {
dom: false,
angular: false,
Expand Down
1 change: 0 additions & 1 deletion lib/rules/no-await-sync-events.ts
Expand Up @@ -21,7 +21,6 @@ export default createTestingLibraryRule<Options, MessageIds>({
type: 'problem',
docs: {
description: 'Disallow unnecessary `await` for sync events',
category: 'Best Practices',
recommendedConfig: {
dom: false,
angular: false,
Expand Down
1 change: 0 additions & 1 deletion lib/rules/no-await-sync-query.ts
Expand Up @@ -13,7 +13,6 @@ export default createTestingLibraryRule<Options, MessageIds>({
type: 'problem',
docs: {
description: 'Disallow unnecessary `await` for sync queries',
category: 'Best Practices',
recommendedConfig: {
dom: 'error',
angular: 'error',
Expand Down
1 change: 0 additions & 1 deletion lib/rules/no-container.ts
Expand Up @@ -20,7 +20,6 @@ export default createTestingLibraryRule<Options, MessageIds>({
type: 'problem',
docs: {
description: 'Disallow the use of `container` methods',
category: 'Best Practices',
recommendedConfig: {
dom: false,
angular: 'error',
Expand Down
1 change: 0 additions & 1 deletion lib/rules/no-debugging-utils.ts
Expand Up @@ -31,7 +31,6 @@ export default createTestingLibraryRule<Options, MessageIds>({
type: 'problem',
docs: {
description: 'Disallow the use of debugging utilities like `debug`',
category: 'Best Practices',
recommendedConfig: {
dom: false,
angular: 'error',
Expand Down
1 change: 0 additions & 1 deletion lib/rules/no-dom-import.ts
Expand Up @@ -18,7 +18,6 @@ export default createTestingLibraryRule<Options, MessageIds>({
type: 'problem',
docs: {
description: 'Disallow importing from DOM Testing Library',
category: 'Best Practices',
recommendedConfig: {
dom: false,
angular: ['error', 'angular'],
Expand Down
1 change: 0 additions & 1 deletion lib/rules/no-manual-cleanup.ts
Expand Up @@ -29,7 +29,6 @@ export default createTestingLibraryRule<Options, MessageIds>({
type: 'problem',
docs: {
description: 'Disallow the use of `cleanup`',
category: 'Best Practices',
recommendedConfig: {
dom: false,
angular: false,
Expand Down
1 change: 0 additions & 1 deletion lib/rules/no-node-access.ts
Expand Up @@ -13,7 +13,6 @@ export default createTestingLibraryRule<Options, MessageIds>({
type: 'problem',
docs: {
description: 'Disallow direct Node access',
category: 'Best Practices',
recommendedConfig: {
dom: false,
angular: 'error',
Expand Down
1 change: 0 additions & 1 deletion lib/rules/no-promise-in-fire-event.ts
Expand Up @@ -20,7 +20,6 @@ export default createTestingLibraryRule<Options, MessageIds>({
docs: {
description:
'Disallow the use of promises passed to a `fireEvent` method',
category: 'Best Practices',
recommendedConfig: {
dom: 'error',
angular: 'error',
Expand Down
1 change: 0 additions & 1 deletion lib/rules/no-render-in-setup.ts
Expand Up @@ -50,7 +50,6 @@ export default createTestingLibraryRule<Options, MessageIds>({
docs: {
description:
'Disallow the use of `render` in testing frameworks setup functions',
category: 'Best Practices',
recommendedConfig: {
dom: false,
angular: 'error',
Expand Down
1 change: 0 additions & 1 deletion lib/rules/no-unnecessary-act.ts
Expand Up @@ -23,7 +23,6 @@ export default createTestingLibraryRule<Options, MessageIds>({
docs: {
description:
'Disallow wrapping Testing Library utils or empty callbacks in `act`',
category: 'Possible Errors',
recommendedConfig: {
dom: false,
angular: false,
Expand Down
1 change: 0 additions & 1 deletion lib/rules/no-wait-for-empty-callback.ts
Expand Up @@ -18,7 +18,6 @@ export default createTestingLibraryRule<Options, MessageIds>({
docs: {
description:
'Disallow empty callbacks for `waitFor` and `waitForElementToBeRemoved`',
category: 'Best Practices',
recommendedConfig: {
dom: 'error',
angular: 'error',
Expand Down
1 change: 0 additions & 1 deletion lib/rules/no-wait-for-multiple-assertions.ts
Expand Up @@ -17,7 +17,6 @@ export default createTestingLibraryRule<Options, MessageIds>({
docs: {
description:
'Disallow the use of multiple `expect` calls inside `waitFor`',
category: 'Best Practices',
recommendedConfig: {
dom: 'error',
angular: 'error',
Expand Down
1 change: 0 additions & 1 deletion lib/rules/no-wait-for-side-effects.ts
Expand Up @@ -20,7 +20,6 @@ export default createTestingLibraryRule<Options, MessageIds>({
type: 'suggestion',
docs: {
description: 'Disallow the use of side effects in `waitFor`',
category: 'Best Practices',
recommendedConfig: {
dom: 'error',
angular: 'error',
Expand Down
1 change: 0 additions & 1 deletion lib/rules/no-wait-for-snapshot.ts
Expand Up @@ -19,7 +19,6 @@ export default createTestingLibraryRule<Options, MessageIds>({
docs: {
description:
'Ensures no snapshot is generated inside of a `waitFor` call',
category: 'Best Practices',
recommendedConfig: {
dom: 'error',
angular: 'error',
Expand Down
1 change: 0 additions & 1 deletion lib/rules/prefer-explicit-assert.ts
Expand Up @@ -69,7 +69,6 @@ export default createTestingLibraryRule<Options, MessageIds>({
docs: {
description:
'Suggest using explicit assertions rather than standalone queries',
category: 'Best Practices',
recommendedConfig: {
dom: false,
angular: false,
Expand Down
1 change: 0 additions & 1 deletion lib/rules/prefer-find-by.ts
Expand Up @@ -56,7 +56,6 @@ export default createTestingLibraryRule<Options, MessageIds>({
docs: {
description:
'Suggest using `find(All)By*` query instead of `waitFor` + `get(All)By*` to wait for elements',
category: 'Best Practices',
recommendedConfig: {
dom: 'error',
angular: 'error',
Expand Down
1 change: 0 additions & 1 deletion lib/rules/prefer-presence-queries.ts
Expand Up @@ -11,7 +11,6 @@ export default createTestingLibraryRule<Options, MessageIds>({
name: RULE_NAME,
meta: {
docs: {
category: 'Best Practices',
description:
'Ensure appropriate `get*`/`query*` queries are used with their respective matchers',
recommendedConfig: {
Expand Down
1 change: 0 additions & 1 deletion lib/rules/prefer-query-by-disappearance.ts
Expand Up @@ -23,7 +23,6 @@ export default createTestingLibraryRule<Options, MessageIds>({
docs: {
description:
'Suggest using `queryBy*` queries when waiting for disappearance',
category: 'Possible Errors',
recommendedConfig: {
dom: 'error',
angular: 'error',
Expand Down
1 change: 0 additions & 1 deletion lib/rules/prefer-screen-queries.ts
Expand Up @@ -40,7 +40,6 @@ export default createTestingLibraryRule<Options, MessageIds>({
type: 'suggestion',
docs: {
description: 'Suggest using `screen` while querying',
category: 'Best Practices',
recommendedConfig: {
dom: 'error',
angular: 'error',
Expand Down
1 change: 0 additions & 1 deletion lib/rules/prefer-user-event.ts
Expand Up @@ -71,7 +71,6 @@ export default createTestingLibraryRule<Options, MessageIds>({
docs: {
description:
'Suggest using `userEvent` over `fireEvent` for simulating user interactions',
category: 'Best Practices',
recommendedConfig: {
dom: false,
angular: false,
Expand Down
1 change: 0 additions & 1 deletion lib/rules/prefer-wait-for.ts
Expand Up @@ -26,7 +26,6 @@ export default createTestingLibraryRule<Options, MessageIds>({
type: 'suggestion',
docs: {
description: 'Use `waitFor` instead of deprecated wait methods',
category: 'Best Practices',
recommendedConfig: {
dom: false,
angular: false,
Expand Down
1 change: 0 additions & 1 deletion lib/rules/render-result-naming-convention.ts
Expand Up @@ -24,7 +24,6 @@ export default createTestingLibraryRule<Options, MessageIds>({
type: 'suggestion',
docs: {
description: 'Enforce a valid naming for return value from `render`',
category: 'Best Practices',
recommendedConfig: {
dom: false,
angular: 'error',
Expand Down
17 changes: 8 additions & 9 deletions package.json
Expand Up @@ -42,25 +42,24 @@
"prepare": "is-ci || husky install"
},
"dependencies": {
"@typescript-eslint/experimental-utils": "^4.30.0"
"@typescript-eslint/experimental-utils": "^5.0.0"
},
"devDependencies": {
"@babel/eslint-plugin": "^7.14.5",
"@commitlint/cli": "^13.2.1",
"@commitlint/config-conventional": "^13.2.0",
"@types/jest": "^27.0.2",
"@types/node": "^16.10.6",
"@typescript-eslint/eslint-plugin": "^4.30.0",
"@typescript-eslint/parser": "^4.30.0",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.0.0",
"cpy-cli": "^3.1.1",
"eslint": "^7.32.0",
"eslint-config-kentcdodds": "^19.1.1",
"eslint": "^8.0.0",
Copy link
Member

Choose a reason for hiding this comment

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

As mentioned in previous comment, let's put this back to v7 so we can go ahead with the release of our plugin v5:

Suggested change
"eslint": "^8.0.0",
"eslint": "^7.32.0",

"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.24.2",
"eslint-plugin-jest": "^24.4.0",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-jest": "^25.0.6",
"eslint-plugin-jest-formatting": "^3.0.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.4.1",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-promise": "^5.1.0",
"husky": "^7.0.2",
"is-ci": "^3.0.0",
Expand All @@ -73,7 +72,7 @@
"typescript": "^4.4.4"
},
"peerDependencies": {
"eslint": "^7.5.0"
"eslint": "^7.5.0 || ^8.0.0"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0",
Expand Down
1 change: 0 additions & 1 deletion tests/fake-rule.ts
Expand Up @@ -26,7 +26,6 @@ export default createTestingLibraryRule<Options, MessageIds>({
type: 'problem',
docs: {
description: 'Fake rule to test rule maker and detection helpers',
category: 'Possible Errors',
recommendedConfig: {
dom: false,
angular: false,
Expand Down