Skip to content

Commit

Permalink
Update eslint (major) (#400)
Browse files Browse the repository at this point in the history
* Update eslint

* Update code to use stabilized APIs

* Use absolute parser path

eslint/eslint#11728

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Luiz Ferraz <luiz.ferraz@croct.com>
  • Loading branch information
renovate[bot] and Fryuni authored Aug 16, 2023
1 parent 87ddbae commit d9587c7
Show file tree
Hide file tree
Showing 16 changed files with 818 additions and 295 deletions.
1,023 changes: 774 additions & 249 deletions package-lock.json

Large diffs are not rendered by default.

15 changes: 7 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,30 +37,29 @@
],
"dependencies": {
"@rushstack/eslint-patch": "^1.1",
"@typescript-eslint/eslint-plugin": "^5.10",
"@typescript-eslint/experimental-utils": "^5.10",
"@typescript-eslint/eslint-plugin": "^6.4.0",
"@typescript-eslint/utils": "^6.4.0",
"eslint-config-airbnb": "^19.0",
"eslint-config-airbnb-base": "^15.0",
"eslint-plugin-cypress": "^2.12",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.25",
"eslint-plugin-import-newlines": "^1.1",
"eslint-plugin-jest": "^27.0.0",
"eslint-plugin-jest-dom": "^4.0",
"eslint-plugin-jest-dom": "^5.0.0",
"eslint-plugin-jsx-a11y": "^6.5",
"eslint-plugin-newline-destructuring": "^1.0.1",
"eslint-plugin-no-smart-quotes": "^1.3",
"eslint-plugin-react": "^7.28",
"eslint-plugin-react-hooks": "^4.3",
"eslint-plugin-testing-library": "^5.0"
"eslint-plugin-testing-library": "^6.0.0"
},
"devDependencies": {
"@types/eslint": "^8.4",
"@types/jest": "^29.0.0",
"@types/semver": "^7.3.12",
"@typescript-eslint/parser": "^5.10",
"@typescript-eslint/types": "^5.10",
"@typescript-eslint/utils": "^5.10",
"@typescript-eslint/parser": "^6.4.0",
"@typescript-eslint/types": "^6.4.0",
"eslint": "^8.8",
"eslint-plugin-eslint-plugin": "^5.0.0",
"eslint-plugin-self": "^1.2.1",
Expand All @@ -69,7 +68,7 @@
"typescript": "^5.0.0"
},
"peerDependencies": {
"@typescript-eslint/parser": ">= 5",
"@typescript-eslint/parser": ">= 6",
"eslint": ">= 8"
}
}
6 changes: 3 additions & 3 deletions src/rules/argument-spacing/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {ESLintUtils} from '@typescript-eslint/utils';
import {RuleTester} from '@typescript-eslint/utils/ts-eslint';
import {argumentSpacing} from './index';

const ruleTester = new ESLintUtils.RuleTester({
parser: '@typescript-eslint/parser',
const ruleTester = new RuleTester({
parser: require.resolve('@typescript-eslint/parser'),
});

ruleTester.run('argument-spacing', argumentSpacing, {
Expand Down
4 changes: 2 additions & 2 deletions src/rules/argument-spacing/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {TSESTree} from '@typescript-eslint/experimental-utils';
import {TSESTree} from '@typescript-eslint/utils';
import {createRule} from '../createRule';

export const argumentSpacing = createRule({
Expand All @@ -8,7 +8,7 @@ export const argumentSpacing = createRule({
docs: {
description: 'Enforces a surrounding line break before and after '
+ 'the argument list in multiline functional calls.',
recommended: 'error',
recommended: 'recommended',
},
fixable: 'whitespace',
schema: [],
Expand Down
6 changes: 3 additions & 3 deletions src/rules/complex-expression-spacing/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {ESLintUtils} from '@typescript-eslint/utils';
import {RuleTester} from '@typescript-eslint/utils/ts-eslint';
import {complexExpressionSpacing} from './index';

const ruleTester = new ESLintUtils.RuleTester({
parser: '@typescript-eslint/parser',
const ruleTester = new RuleTester({
parser: require.resolve('@typescript-eslint/parser'),
});

ruleTester.run('complex-expression-spacing', complexExpressionSpacing, {
Expand Down
4 changes: 2 additions & 2 deletions src/rules/complex-expression-spacing/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {TSESTree} from '@typescript-eslint/experimental-utils';
import {TSESTree} from '@typescript-eslint/utils';
import {createRule} from '../createRule';

export const complexExpressionSpacing = createRule({
Expand All @@ -7,7 +7,7 @@ export const complexExpressionSpacing = createRule({
type: 'suggestion',
docs: {
description: 'Enforces a surrounding line break in complex expression.',
recommended: 'error',
recommended: 'recommended',
},
fixable: 'whitespace',
schema: [],
Expand Down
2 changes: 1 addition & 1 deletion src/rules/createRule.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ESLintUtils} from '@typescript-eslint/experimental-utils';
import {ESLintUtils} from '@typescript-eslint/utils';

export const createRule = ESLintUtils.RuleCreator(
name => `https://github.com/croct-tech/coding-standard-js/tree/master/docs/${name}.md`,
Expand Down
6 changes: 3 additions & 3 deletions src/rules/jsx-attribute-spacing/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {ESLintUtils} from '@typescript-eslint/utils';
import {RuleTester} from '@typescript-eslint/utils/ts-eslint';
import {jsxAttributeSpacing} from './index';

const ruleTester = new ESLintUtils.RuleTester({
parser: '@typescript-eslint/parser',
const ruleTester = new RuleTester({
parser: require.resolve('@typescript-eslint/parser'),
parserOptions: {
ecmaFeatures: {
jsx: true,
Expand Down
4 changes: 2 additions & 2 deletions src/rules/jsx-attribute-spacing/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {TSESTree} from '@typescript-eslint/experimental-utils';
import {TSESTree} from '@typescript-eslint/utils';
import {createRule} from '../createRule';

export const jsxAttributeSpacing = createRule({
Expand All @@ -7,7 +7,7 @@ export const jsxAttributeSpacing = createRule({
type: 'suggestion',
docs: {
description: 'Enforces a surrounding line break in multiline JSX attributes.',
recommended: 'error',
recommended: 'recommended',
},
fixable: 'whitespace',
schema: [],
Expand Down
6 changes: 3 additions & 3 deletions src/rules/min-chained-call-depth/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {ESLintUtils} from '@typescript-eslint/utils';
import {RuleTester} from '@typescript-eslint/utils/ts-eslint';
import {minChainedCallDepth} from './index';

const ruleTester = new ESLintUtils.RuleTester({
parser: '@typescript-eslint/parser',
const ruleTester = new RuleTester({
parser: require.resolve('@typescript-eslint/parser'),
parserOptions: {
ecmaFeatures: {
jsx: true,
Expand Down
6 changes: 3 additions & 3 deletions src/rules/min-chained-call-depth/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {AST_TOKEN_TYPES, AST_NODE_TYPES, TSESTree} from '@typescript-eslint/experimental-utils';
import {isCommentToken} from '@typescript-eslint/utils/dist/ast-utils';
import {AST_TOKEN_TYPES, AST_NODE_TYPES, TSESTree} from '@typescript-eslint/utils';
import {isCommentToken} from '@typescript-eslint/utils/ast-utils';
import {createRule} from '../createRule';

export const minChainedCallDepth = createRule({
Expand All @@ -8,7 +8,7 @@ export const minChainedCallDepth = createRule({
type: 'layout',
docs: {
description: 'Enforces a minimum depth for multiline chained calls.',
recommended: 'error',
recommended: 'stylistic',
},
fixable: 'whitespace',
schema: [
Expand Down
6 changes: 3 additions & 3 deletions src/rules/newline-per-chained-call/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {ESLintUtils} from '@typescript-eslint/utils';
import {RuleTester} from '@typescript-eslint/utils/ts-eslint';
import {newlinePerChainedCall} from './index';

const ruleTester = new ESLintUtils.RuleTester({
parser: '@typescript-eslint/parser',
const ruleTester = new RuleTester({
parser: require.resolve('@typescript-eslint/parser'),
parserOptions: {
ecmaFeatures: {
jsx: true,
Expand Down
7 changes: 3 additions & 4 deletions src/rules/newline-per-chained-call/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {TSESTree} from '@typescript-eslint/experimental-utils';
import {Expression} from '@typescript-eslint/types/dist/generated/ast-spec';
import {TSESTree} from '@typescript-eslint/utils';
import {createRule} from '../createRule';

const LINEBREAK_MATCHER = /\r\n|[\r\n\u2028\u2029]/u;
Expand All @@ -10,7 +9,7 @@ export const newlinePerChainedCall = createRule({
type: 'layout',
docs: {
description: 'Require a newline after each call in a method chain',
recommended: 'error',
recommended: 'recommended',
},
fixable: 'whitespace',
schema: [
Expand Down Expand Up @@ -73,7 +72,7 @@ export const newlinePerChainedCall = createRule({
) {
const memberExpressions = [];

let currentNode: Expression = (
let currentNode: TSESTree.Expression = (
node.type === 'CallExpression'
? node.callee
: node
Expand Down
6 changes: 3 additions & 3 deletions src/rules/parameter-destructuring/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {ESLintUtils} from '@typescript-eslint/utils';
import {RuleTester} from '@typescript-eslint/utils/ts-eslint';
import {parameterDestructuring} from './index';

const ruleTester = new ESLintUtils.RuleTester({
parser: '@typescript-eslint/parser',
const ruleTester = new RuleTester({
parser: require.resolve('@typescript-eslint/parser'),
parserOptions: {
ecmaFeatures: {
jsx: true,
Expand Down
6 changes: 3 additions & 3 deletions src/rules/parameter-destructuring/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {AST_NODE_TYPES} from '@typescript-eslint/types';
import {RuleFix} from '@typescript-eslint/utils/dist/ts-eslint';
import {AST_NODE_TYPES} from '@typescript-eslint/utils';
import {RuleFix} from '@typescript-eslint/utils/ts-eslint';
import {createRule} from '../createRule';

export const parameterDestructuring = createRule({
Expand All @@ -8,7 +8,7 @@ export const parameterDestructuring = createRule({
type: 'layout',
docs: {
description: 'Prevent noisy destructuring on parameters',
recommended: 'error',
recommended: 'recommended',
},
hasSuggestions: true,
schema: [],
Expand Down
6 changes: 3 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"compilerOptions": {
"module": "CommonJS",
"target": "es6",
"moduleResolution": "Node",
"target": "ES2020",
"moduleResolution": "node16",
"allowSyntheticDefaultImports": true,
"resolveJsonModule": true,
"noImplicitAny": true,
Expand All @@ -15,7 +15,7 @@
"removeComments": false,
"outDir": "dist",
"downlevelIteration": true,
"declaration": true,
"declaration": false,
"lib": ["es6"]
},
"include": [
Expand Down

0 comments on commit d9587c7

Please sign in to comment.