Skip to content

Commit

Permalink
feat: support ESLint 8.x
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Requires Node@^12.22.0 || ^14.17.0 || >=16.0.0
BREAKING CHANGE: Requires ESLint@^8.0.0-0
  • Loading branch information
MichaelDeBoey committed Oct 10, 2021
1 parent 1c1c009 commit 10bf84c
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"@babel/preset-env",
{
"targets": {
"node": 10
"node": 12
}
}
]
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: node_js
node_js:
- node
- 10
- 12
before_install:
- npm config set depth 0
notifications:
Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@
},
"description": "Flowtype linting rules for ESLint.",
"devDependencies": {
"@babel/cli": "^7.15.4",
"@babel/core": "^7.15.5",
"@babel/node": "^7.15.4",
"@babel/cli": "^7.15.7",
"@babel/core": "^7.15.8",
"@babel/eslint-parser": "^7.15.8",
"@babel/node": "^7.15.8",
"@babel/plugin-proposal-object-rest-spread": "^7.15.6",
"@babel/preset-env": "^7.15.6",
"@babel/preset-env": "^7.15.8",
"@babel/register": "^7.15.3",
"ajv": "^8.6.3",
"babel-eslint": "^10.1.0",
"babel-plugin-add-module-exports": "^1.0.4",
"chai": "^4.3.4",
"eclint": "^2.8.1",
"eslint": "^7.32.0",
"eslint": "^8.0.0",
"eslint-config-canonical": "^27.0.1",
"gitdown": "^3.1.4",
"glob": "^7.1.7",
Expand All @@ -32,7 +32,7 @@
"semantic-release": "^17.4.7"
},
"engines": {
"node": "^10.12.0 || >=12.0.0"
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
"husky": {
"hooks": {
Expand All @@ -48,7 +48,7 @@
"main": "./dist/index.js",
"name": "eslint-plugin-flowtype",
"peerDependencies": {
"eslint": "^7.32.0"
"eslint": "^8.0.0"
},
"repository": {
"type": "git",
Expand Down
3 changes: 2 additions & 1 deletion src/rules/noUnusedExpressions.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// A wrapper around ESLint's core rule no-unused-expressions, additionally ignores type cast
// expressions.
import { builtinRules } from 'eslint/use-at-your-own-risk';

import coreNOE from 'eslint/lib/rules/no-unused-expressions';
const coreNOE = builtinRules.get('no-unused-expressions');

const meta = coreNOE.meta;

Expand Down
12 changes: 6 additions & 6 deletions tests/rules/assertions/defineFlowType.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
RuleTester,
} from 'eslint';
import noUndefRule from 'eslint/lib/rules/no-undef';
import { RuleTester } from 'eslint';
import { builtinRules } from 'eslint/use-at-your-own-risk';

const noUndefRule = builtinRules.get('no-undef');

const VALID_WITH_DEFINE_FLOW_TYPE = [
{
Expand Down Expand Up @@ -198,7 +198,7 @@ const ALWAYS_VALID = [
*/
{
const ruleTester = new RuleTester({
parser: require.resolve('babel-eslint'),
parser: require.resolve('@babel/eslint-parser'),
});

ruleTester.run('no-undef must not trigger an error in these cases', noUndefRule, {
Expand All @@ -209,7 +209,7 @@ const ALWAYS_VALID = [

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

ruleTester.run('no-undef must trigger an error when define-flow-type is not used in these cases', noUndefRule, {
Expand Down
14 changes: 7 additions & 7 deletions tests/rules/assertions/useFlowType.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {
RuleTester,
} from 'eslint';
import noUnusedVarsRule from 'eslint/lib/rules/no-unused-vars';
import { RuleTester } from 'eslint';
import { builtinRules } from 'eslint/use-at-your-own-risk';
import useFlowType from '../../../src/rules/useFlowType';

const noUnusedVarsRule = builtinRules.get('no-unused-vars');

const VALID_WITH_USE_FLOW_TYPE = [
{
code: 'declare class A {}',
Expand Down Expand Up @@ -92,7 +92,7 @@ const ALWAYS_VALID = [
*/
{
const ruleTester = new RuleTester({
parser: require.resolve('babel-eslint'),
parser: require.resolve('@babel/eslint-parser'),
});

ruleTester.run('no-unused-vars must not trigger an error in these cases', noUnusedVarsRule, {
Expand All @@ -103,7 +103,7 @@ const ALWAYS_VALID = [

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

ruleTester.run('no-unused-vars must trigger an error in these cases', noUnusedVarsRule, {
Expand All @@ -117,7 +117,7 @@ const ALWAYS_VALID = [

{
const ruleTester = new RuleTester({
parser: require.resolve('babel-eslint'),
parser: require.resolve('@babel/eslint-parser'),
rules: {
'use-flow-type': 1,
},
Expand Down
2 changes: 1 addition & 1 deletion tests/rules/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const reportingRules = [
'valid-syntax',
];

const parser = require.resolve('babel-eslint');
const parser = require.resolve('@babel/eslint-parser');
const ajv = new Ajv({
verbose: true,
});
Expand Down

0 comments on commit 10bf84c

Please sign in to comment.