Skip to content

Commit

Permalink
feat!: add support for eslint 8 and drop support for older versions
Browse files Browse the repository at this point in the history
fix #278
  • Loading branch information
RebeccaStevens committed Oct 17, 2021
1 parent 92500fc commit 6a02f5f
Show file tree
Hide file tree
Showing 22 changed files with 312 additions and 378 deletions.
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@
"verify": "yarn build && yarn lint && yarn build-tests && yarn test-compiled && rimraf build"
},
"dependencies": {
"@typescript-eslint/experimental-utils": "^4.31.1",
"@typescript-eslint/experimental-utils": "^5.0.0",
"deepmerge-ts": "^1.0.1",
"escape-string-regexp": "^4.0.0"
},
"devDependencies": {
"@commitlint/cli": "^13.1.0",
"@commitlint/config-conventional": "^13.1.0",
"@istanbuljs/nyc-config-typescript": "^1.0.1",
"@rebeccastevens/eslint-config": "^1.1.3",
"@rebeccastevens/eslint-config": "^1.1.4",
"@rollup/plugin-commonjs": "^20.0.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^13.0.4",
Expand All @@ -82,37 +82,37 @@
"@semantic-release/npm": "^8.0.0",
"@semantic-release/release-notes-generator": "^10.0.2",
"@types/dedent": "^0.7.0",
"@types/eslint": "^7.2.6",
"@types/eslint": "^7.28.1",
"@types/estree": "^0.0.50",
"@types/node": "16.10.2",
"@types/rollup-plugin-auto-external": "^2.0.2",
"@typescript-eslint/eslint-plugin": "^4.28.4",
"@typescript-eslint/parser": "^4.28.4",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.0.0",
"ava": "^3.15.0",
"babel-eslint": "^10.0.2",
"babel-eslint": "^10.1.0",
"chalk": "^4.1.2",
"codecov": "^3.8.1",
"commitizen": "^4.2.4",
"conventional-commit-types": "^3.0.0",
"cross-env": "^7.0.3",
"cspell": "^5.7.0",
"dedent": "^0.7.0",
"eslint": "^7.31.0",
"eslint": "^8.0.1",
"eslint-ava-rule-tester": "^4.0.0",
"eslint-config-prettier": "^8.3.0",
"eslint-import-resolver-typescript": "^2.4.0",
"eslint-plugin-ava": "^13.0.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-eslint-plugin": "^3.4.0",
"eslint-plugin-import": "^2.23.4",
"eslint-plugin-jsdoc": "^36.1.0",
"eslint-plugin-eslint-plugin": "^3.6.1",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-jsdoc": "^36.1.1",
"eslint-plugin-markdown": "^2.2.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-optimize-regex": "^1.2.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-promise": "^5.1.0",
"eslint-plugin-sonarjs": "^0.10.0",
"eslint-plugin-unicorn": "^36.0.0",
"eslint-plugin-unicorn": "^37.0.1",
"espree": "^9.0.0",
"husky": "^7.0.2",
"json-schema": "^0.3.0",
Expand All @@ -134,7 +134,7 @@
"word-wrap": "^1.2.3"
},
"peerDependencies": {
"eslint": "^5.0.0 || ^6.0.0 || ^7.0.0",
"eslint": "^8.0.0",
"tsutils": "^3.0.0",
"typescript": "^3.4.1 || ^4.0.0"
},
Expand All @@ -147,6 +147,6 @@
}
},
"engines": {
"node": ">=12.4.0"
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
}
}
4 changes: 2 additions & 2 deletions src/common/ignore-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
hasID,
hasKey,
isAssignmentExpression,
isClassProperty,
isPropertyDefinition,
isExpressionStatement,
isIdentifier,
isMemberExpression,
Expand Down Expand Up @@ -271,7 +271,7 @@ export function shouldIgnoreClass(
return (
(options.ignoreClass === true && inClass(node)) ||
(options.ignoreClass === "fieldsOnly" &&
(isClassProperty(node) ||
(isPropertyDefinition(node) ||
(isAssignmentExpression(node) &&
inClass(node) &&
isMemberExpression(node.left) &&
Expand Down
1 change: 0 additions & 1 deletion src/rules/functional-parameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ const meta: RuleMetaData<keyof typeof errorMessages> = {
type: "suggestion",
docs: {
description: "Enforce functional parameters.",
category: "Best Practices",
recommended: "error",
},
messages: errorMessages,
Expand Down
1 change: 0 additions & 1 deletion src/rules/immutable-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ const meta: RuleMetaData<keyof typeof errorMessages> = {
type: "suggestion",
docs: {
description: "Enforce treating data as immutable.",
category: "Best Practices",
recommended: "error",
},
messages: errorMessages,
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const meta: RuleMetaData<keyof typeof errorMessages> = {
type: "suggestion",
docs: {
description: "Disallow classes.",
category: "Best Practices",
recommended: "error",
},
messages: errorMessages,
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-conditional-statement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ const meta: RuleMetaData<keyof typeof errorMessages> = {
type: "suggestion",
docs: {
description: "Disallow conditional statements.",
category: "Best Practices",
recommended: "error",
},
messages: errorMessages,
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-expression-statement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ const meta: RuleMetaData<keyof typeof errorMessages> = {
type: "suggestion",
docs: {
description: "Disallow expression statements.",
category: "Best Practices",
recommended: "error",
},
messages: errorMessages,
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-let.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ const meta: RuleMetaData<keyof typeof errorMessages> = {
type: "suggestion",
docs: {
description: "Disallow mutable variables.",
category: "Best Practices",
recommended: "error",
},
messages: errorMessages,
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-loop-statement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const meta: RuleMetaData<keyof typeof errorMessages> = {
type: "suggestion",
docs: {
description: "Disallow imperative loops.",
category: "Best Practices",
recommended: "error",
},
messages: errorMessages,
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-method-signature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ const meta: RuleMetaData<keyof typeof errorMessages> = {
docs: {
description:
"Prefer property signatures with readonly modifiers over method signatures.",
category: "Best Practices",
recommended: "warn",
},
messages: errorMessages,
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-mixed-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ const meta: RuleMetaData<keyof typeof errorMessages> = {
docs: {
description:
"Restrict types so that only members of the same kind of are allowed in them.",
category: "Best Practices",
recommended: "error",
},
messages: errorMessages,
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-promise-reject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ const meta: RuleMetaData<keyof typeof errorMessages> = {
type: "suggestion",
docs: {
description: "Disallow try-catch[-finally] and try-finally patterns.",
category: "Best Practices",
recommended: false,
},
messages: errorMessages,
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-return-void.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ const meta: RuleMetaData<keyof typeof errorMessages> = {
type: "suggestion",
docs: {
description: "Disallow functions that don't return anything.",
category: "Best Practices",
recommended: "error",
},
messages: errorMessages,
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-this-expression.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const meta: RuleMetaData<keyof typeof errorMessages> = {
type: "suggestion",
docs: {
description: "Disallow this access.",
category: "Best Practices",
recommended: "error",
},
messages: errorMessages,
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-throw-statement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const meta: RuleMetaData<keyof typeof errorMessages> = {
type: "suggestion",
docs: {
description: "Disallow throwing exceptions.",
category: "Best Practices",
recommended: "error",
},
messages: errorMessages,
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-try-statement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ const meta: RuleMetaData<keyof typeof errorMessages> = {
type: "suggestion",
docs: {
description: "Disallow try-catch[-finally] and try-finally patterns.",
category: "Best Practices",
recommended: "error",
},
messages: errorMessages,
Expand Down
5 changes: 2 additions & 3 deletions src/rules/prefer-readonly-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ const meta: RuleMetaData<keyof typeof errorMessages> = {
type: "suggestion",
docs: {
description: "Prefer readonly array over mutable arrays.",
category: "Best Practices",
recommended: "error",
},
messages: errorMessages,
Expand Down Expand Up @@ -259,7 +258,7 @@ function checkTypeReference(
*/
function checkProperty(
node:
| TSESTree.ClassProperty
| TSESTree.PropertyDefinition
| TSESTree.TSIndexSignature
| TSESTree.TSParameterProperty
| TSESTree.TSPropertySignature,
Expand Down Expand Up @@ -380,7 +379,7 @@ export const rule = createRule<keyof typeof errorMessages, Options>(
defaultOptions,
{
ArrowFunctionExpression: checkImplicitType,
ClassProperty: checkProperty,
PropertyDefinition: checkProperty,
FunctionDeclaration: checkImplicitType,
FunctionExpression: checkImplicitType,
TSArrayType: checkArrayOrTupleType,
Expand Down
1 change: 0 additions & 1 deletion src/rules/prefer-tacit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ const meta: RuleMetaData<keyof typeof errorMessages> = {
type: "suggestion",
docs: {
description: "Replaces `x => f(x)` with just `f`.",
category: "Best Practices",
recommended: false,
},
messages: errorMessages,
Expand Down
6 changes: 3 additions & 3 deletions src/util/typeguard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ export function isCallExpression(
return node.type === AST_NODE_TYPES.CallExpression;
}

export function isClassProperty(
export function isPropertyDefinition(
node: TSESTree.Node
): node is TSESTree.ClassProperty {
return node.type === AST_NODE_TYPES.ClassProperty;
): node is TSESTree.PropertyDefinition {
return node.type === AST_NODE_TYPES.PropertyDefinition;
}

/**
Expand Down
1 change: 0 additions & 1 deletion tests/helpers/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ export function createDummyRule(
type: "suggestion",
docs: {
description: "Disallow mutable variables.",
category: "Best Practices",
recommended: "error",
url: "",
},
Expand Down
Loading

0 comments on commit 6a02f5f

Please sign in to comment.