Skip to content

Commit

Permalink
fixup! chore: upgrade typescript-eslint to v8
Browse files Browse the repository at this point in the history
  • Loading branch information
mainframev committed Oct 10, 2024
1 parent f203650 commit 24d16e4
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 236 deletions.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"@phenomnomnominal/tsquery": "6.1.3",
"@playwright/test": "1.44.0",
"@react-native/babel-preset": "0.73.21",
"@rnx-kit/eslint-plugin": "0.7.2",
"@rnx-kit/eslint-plugin": "0.8.2",
"@rollup/plugin-node-resolve": "13.3.0",
"@storybook/addon-a11y": "7.6.20",
"@storybook/addon-actions": "7.6.20",
Expand Down Expand Up @@ -173,10 +173,10 @@
"@types/webpack-hot-middleware": "2.25.9",
"@types/yargs": "13.0.11",
"@types/yargs-unparser": "2.0.1",
"@typescript-eslint/eslint-plugin": "8.2.0",
"@typescript-eslint/parser": "8.2.0",
"@typescript-eslint/rule-tester": "8.2.0",
"@typescript-eslint/utils": "8.2.0",
"@typescript-eslint/eslint-plugin": "8.8.1",
"@typescript-eslint/parser": "8.8.1",
"@typescript-eslint/rule-tester": "8.8.1",
"@typescript-eslint/utils": "8.8.1",
"@wojtekmaj/enzyme-adapter-react-17": "0.6.7",
"ajv": "8.4.0",
"autoprefixer": "10.2.1",
Expand Down
12 changes: 6 additions & 6 deletions packages/eslint-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
},
"dependencies": {
"@griffel/eslint-plugin": "^1.6.4",
"@rnx-kit/eslint-plugin": "^0.7.2",
"@typescript-eslint/eslint-plugin": "^8.2.0",
"@typescript-eslint/utils": "^8.2.0",
"@typescript-eslint/rule-tester": "8.2.0",
"@typescript-eslint/parser": "^8.2.0",
"@typescript-eslint/type-utils": "^8.2.0",
"@rnx-kit/eslint-plugin": "^0.8.2",
"@typescript-eslint/eslint-plugin": "^8.8.1",
"@typescript-eslint/utils": "^8.8.1",
"@typescript-eslint/rule-tester": "8.8.1",
"@typescript-eslint/parser": "^8.8.1",
"@typescript-eslint/type-utils": "^8.8.1",
"eslint-config-airbnb": "^18.2.1",
"eslint-config-prettier": "^8.3.0",
"eslint-import-resolver-typescript": "^3.6.1",
Expand Down
2 changes: 2 additions & 0 deletions tools/eslint-rules/rules/consistent-callback-type.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { rule, RULE_NAME } from './consistent-callback-type';

const ruleTester = new RuleTester();

global.structuredClone = val => JSON.parse(JSON.stringify(val));

ruleTester.run(RULE_NAME, rule, {
valid: [
// Valid when prop is TSTypeAliasDeclaration and the callback uses EventHandler
Expand Down
9 changes: 7 additions & 2 deletions tools/eslint-rules/rules/no-restricted-globals.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { AST_NODE_TYPES } from '@typescript-eslint/utils';
import { rule, RULE_NAME } from './no-restricted-globals';

const ruleTester = new RuleTester();
global.structuredClone = val => JSON.parse(JSON.stringify(val));

ruleTester.run(RULE_NAME, rule, {
valid: [
Expand All @@ -18,7 +19,9 @@ ruleTester.run(RULE_NAME, rule, {
{
code: 'event',
options: ['foo'],
globals: globals.browser,
languageOptions: {
globals: globals.browser,
},
},
{ options: ['KeyboardEvent'], code: `let ev: KeyboardEvent;` },
{
Expand All @@ -44,7 +47,9 @@ ruleTester.run(RULE_NAME, rule, {
{
code: 'event',
options: ['foo', 'event'],
globals: globals.browser,
languageOptions: {
globals: globals.browser,
},
errors: [
{
messageId: 'defaultMessage',
Expand Down
11 changes: 7 additions & 4 deletions tools/eslint-rules/rules/no-restricted-globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,19 @@
*/

import { Reference } from '@typescript-eslint/scope-manager';
import { ESLintUtils, AST_NODE_TYPES } from '@typescript-eslint/utils';

import { ESLintUtils, AST_NODE_TYPES, TSESTree, TSESLint } from '@typescript-eslint/utils';
// NOTE: The rule will be available in ESLint configs as "@nx/workspace-no-restricted-globals"
export const RULE_NAME = 'no-restricted-globals';

type MessageIds = 'defaultMessage' | 'customMessage';

type Options = Array<{ name: string; message?: string } | string>;

export const rule = ESLintUtils.RuleCreator(() => __filename)<Options, MessageIds>({
type Docs = {
recommended: TSESLint.RuleRecommendation;
};

export const rule = ESLintUtils.RuleCreator<Docs>(() => __filename)<Options, MessageIds>({
name: RULE_NAME,
meta: {
type: 'problem',
Expand Down Expand Up @@ -60,7 +63,7 @@ export const rule = ESLintUtils.RuleCreator(() => __filename)<Options, MessageId
},
},
defaultOptions: [],
create(context, options) {
create(context) {
const sourceCode = context.sourceCode;

// If no globals are restricted, we don't need to do anything
Expand Down
Loading

0 comments on commit 24d16e4

Please sign in to comment.