eslint-plugin-primer-react 8.0.0-rc.d848c88 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/.github/copilot-instructions.md +159 -0
  2. package/.github/workflows/add-to-inbox.yml +2 -2
  3. package/.markdownlint-cli2.cjs +2 -2
  4. package/CHANGELOG.md +2 -2
  5. package/eslint.config.js +54 -0
  6. package/package.json +15 -9
  7. package/src/rules/__tests__/a11y-explicit-heading.test.js +5 -3
  8. package/src/rules/__tests__/a11y-link-in-text-block.test.js +5 -3
  9. package/src/rules/__tests__/a11y-no-duplicate-form-labels.test.js +5 -9
  10. package/src/rules/__tests__/a11y-no-title-usage.test.js +5 -3
  11. package/src/rules/__tests__/a11y-remove-disable-tooltip.test.js +5 -3
  12. package/src/rules/__tests__/a11y-tooltip-interactive-trigger.test.js +5 -3
  13. package/src/rules/__tests__/a11y-use-accessible-tooltip.test.js +5 -3
  14. package/src/rules/__tests__/direct-slot-children.test.js +5 -3
  15. package/src/rules/__tests__/enforce-button-for-link-with-nohref.test.js +5 -3
  16. package/src/rules/__tests__/enforce-css-module-identifier-casing.test.js +5 -3
  17. package/src/rules/__tests__/new-color-css-vars.test.js +5 -3
  18. package/src/rules/__tests__/no-deprecated-entrypoints.test.js +5 -3
  19. package/src/rules/__tests__/no-deprecated-experimental-components.test.js +5 -3
  20. package/src/rules/__tests__/no-deprecated-props.test.js +5 -3
  21. package/src/rules/__tests__/no-system-props.test.js +5 -4
  22. package/src/rules/__tests__/no-unnecessary-components.test.js +6 -4
  23. package/src/rules/__tests__/no-wildcard-imports.test.js +6 -43
  24. package/src/rules/__tests__/prefer-action-list-item-onselect.test.js +6 -4
  25. package/src/rules/__tests__/use-deprecated-from-deprecated.test.js +5 -3
  26. package/src/rules/no-deprecated-experimental-components.js +0 -1
  27. package/.eslintignore +0 -2
  28. package/.eslintrc.js +0 -39
  29. package/package-lock.json +0 -15692
@@ -0,0 +1,159 @@
1
+ # eslint-plugin-primer-react
2
+
3
+ ESLint plugin for Primer React components. This is a JavaScript-based ESLint plugin that provides rules for validating and auto-fixing Primer React component usage.
4
+
5
+ **Always reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does not match the info here.**
6
+
7
+ ## Working Effectively
8
+
9
+ ### Bootstrap and Setup
10
+
11
+ - Install Node.js v20+ (v20 is the current standard):
12
+ - Check version: `node --version && npm --version`
13
+ - Install dependencies: `npm ci` -- takes 60 seconds. Set timeout to 90+ seconds.
14
+ - **NO BUILD STEP REQUIRED** - This is a direct JavaScript project with main entry at `src/index.js`
15
+
16
+ ### Development Commands
17
+
18
+ - Run tests: `npm test` -- takes 5 seconds. Fast, no long timeout needed.
19
+ - Run linting: `npm run lint` -- takes 1.5 seconds. Very fast.
20
+ - Run markdown linting: `npm run lint:md` -- takes under 1 second. Very fast.
21
+ - Check formatting: `npm run format:check` -- takes 0.5 seconds. Very fast.
22
+ - Fix formatting: `npm run format` -- applies Prettier formatting fixes.
23
+
24
+ ### Testing and Validation
25
+
26
+ - **ALWAYS** run `npm test` after making changes to rules - tests run in 5 seconds
27
+ - **ALWAYS** run `npm run lint && npm run lint:md` before committing - both complete in under 3 seconds total
28
+ - **ALWAYS** run `npm run format:check` to verify formatting - completes in 0.5 seconds
29
+ - All validation commands are very fast - no need for long timeouts or cancellation warnings
30
+
31
+ ### Manual Rule Testing
32
+
33
+ You can manually test individual rules using this pattern:
34
+
35
+ ```bash
36
+ node -e "
37
+ const rule = require('./src/rules/RULE_NAME');
38
+ const {RuleTester} = require('eslint');
39
+ const ruleTester = new RuleTester({
40
+ parserOptions: {
41
+ ecmaVersion: 'latest',
42
+ sourceType: 'module',
43
+ ecmaFeatures: { jsx: true }
44
+ }
45
+ });
46
+ ruleTester.run('test', rule, {
47
+ valid: [{ code: 'VALID_CODE_HERE' }],
48
+ invalid: [{ code: 'INVALID_CODE_HERE', errors: [{ messageId: 'MESSAGE_ID' }] }]
49
+ });
50
+ "
51
+ ```
52
+
53
+ ## Repository Structure and Navigation
54
+
55
+ ### Key Directories
56
+
57
+ - `src/rules/` - ESLint rule implementations
58
+ - `src/rules/__tests__/` - Jest tests for each rule using ESLint RuleTester
59
+ - `docs/rules/` - Markdown documentation for each rule
60
+ - `src/configs/` - ESLint configuration presets (e.g., recommended.js)
61
+ - `src/utils/` - Utility functions shared across rules
62
+ - `.github/workflows/` - CI pipeline definitions
63
+
64
+ ### Important Files
65
+
66
+ - `src/index.js` - Main entry point, exports all rules and configs
67
+ - `package.json` - Scripts and dependencies (no build scripts needed)
68
+ - `jest.config.js` - Jest test configuration
69
+ - `.eslintrc.js` - ESLint configuration for the project itself
70
+ - `.nvmrc` - Node.js version specification (v20)
71
+
72
+ ### Rule Development Pattern
73
+
74
+ Each rule follows this structure:
75
+
76
+ 1. Rule implementation: `src/rules/rule-name.js`
77
+ 2. Test file: `src/rules/__tests__/rule-name.test.js`
78
+ 3. Documentation: `docs/rules/rule-name.md`
79
+ 4. Export from: `src/index.js` (add to rules object)
80
+ 5. Optional: Add to `src/configs/recommended.js` if should be in recommended preset
81
+
82
+ ## Validation Scenarios
83
+
84
+ ### After Making Rule Changes
85
+
86
+ 1. Run the rule's specific test: `npm test -- --testNamePattern="rule-name"`
87
+ 2. Run all tests: `npm test` (5 seconds)
88
+ 3. Test the rule manually using the Node.js snippet pattern above
89
+ 4. Verify the rule is exported properly from `src/index.js`
90
+
91
+ ### Before Committing
92
+
93
+ 1. `npm run lint` - JavaScript linting (1.5 seconds)
94
+ 2. `npm run lint:md` - Markdown linting (<1 second)
95
+ 3. `npm run format:check` - Formatting validation (0.5 seconds)
96
+ 4. `npm test` - Full test suite (5 seconds)
97
+
98
+ ### Testing Plugin Integration
99
+
100
+ The plugin can be tested by:
101
+
102
+ 1. Using manual Node.js rule testing (shown above)
103
+ 2. Running existing test suite which validates all rules
104
+ 3. Creating test files and using ESLint RuleTester in the **tests** files
105
+
106
+ ## Common Development Tasks
107
+
108
+ ### Adding a New Rule
109
+
110
+ 1. Create rule implementation: `src/rules/new-rule-name.js`
111
+ 2. Create test file: `src/rules/__tests__/new-rule-name.test.js`
112
+ 3. Add to exports in `src/index.js`
113
+ 4. Create documentation: `docs/rules/new-rule-name.md`
114
+ 5. Optionally add to `src/configs/recommended.js`
115
+ 6. Run tests: `npm test`
116
+ 7. Run linting: `npm run lint`
117
+
118
+ ### Modifying Existing Rules
119
+
120
+ 1. Edit rule in `src/rules/rule-name.js`
121
+ 2. Update tests in `src/rules/__tests__/rule-name.test.js`
122
+ 3. Update documentation in `docs/rules/rule-name.md` if needed
123
+ 4. Run tests: `npm test`
124
+ 5. Test manually using Node.js snippet if needed
125
+
126
+ ### Working with Changesets (for releases)
127
+
128
+ - `npx changeset` - Create a changeset for changes
129
+ - `npx changeset status` - Check changeset status
130
+ - Changesets are used for versioning and publishing to npm
131
+
132
+ ## Troubleshooting
133
+
134
+ ### Common Issues
135
+
136
+ - **Node.js version**: Use Node.js v20+ (v20 is the current standard)
137
+ - **Dependencies**: Always use `npm ci` instead of `npm install` for consistent installs
138
+ - **Test failures**: Run `npm test` to see specific failures - tests are fast and detailed
139
+ - **Lint failures**: Run `npm run lint` and `npm run lint:md` to see specific issues
140
+ - **Format issues**: Run `npm run format` to auto-fix formatting
141
+
142
+ ### Rule Testing Issues
143
+
144
+ - Use the RuleTester pattern shown above for manual testing
145
+ - Check that messageId in tests matches the rule's meta.messages
146
+ - Verify JSX parsing works by including ecmaFeatures.jsx in parserOptions
147
+
148
+ ## Command Reference
149
+
150
+ Essential commands and their typical execution times:
151
+
152
+ - `npm ci` - Install dependencies (60 seconds)
153
+ - `npm test` - Run all tests (5 seconds)
154
+ - `npm run lint` - Lint JavaScript (1.5 seconds)
155
+ - `npm run lint:md` - Lint Markdown (<1 second)
156
+ - `npm run format:check` - Check formatting (0.5 seconds)
157
+ - `npm run format` - Fix formatting (similar time)
158
+
159
+ All commands except `npm ci` are very fast. No need for extended timeouts or cancellation warnings on validation commands.
@@ -12,7 +12,7 @@ jobs:
12
12
  PROJECT_ID: 4503
13
13
  steps:
14
14
  - id: get-primer-access-token
15
- uses: actions/create-github-app-token@v1
15
+ uses: actions/create-github-app-token@v2
16
16
  with:
17
17
  app-id: ${{ vars.PRIMER_ISSUE_TRIAGE_APP_ID }}
18
18
  private-key: ${{ secrets.PRIMER_ISSUE_TRIAGE_APP_PRIVATE_KEY }}
@@ -22,7 +22,7 @@ jobs:
22
22
  env:
23
23
  GH_TOKEN: ${{ steps.get-primer-access-token.outputs.token }}
24
24
  - id: get-github-access-token
25
- uses: actions/create-github-app-token@v1
25
+ uses: actions/create-github-app-token@v2
26
26
  with:
27
27
  app-id: ${{ vars.PRIMER_ISSUE_TRIAGE_APP_ID_FOR_GITHUB }}
28
28
  private-key: ${{ secrets.PRIMER_ISSUE_TRIAGE_APP_PRIVATE_KEY_FOR_GITHUB }}
@@ -16,11 +16,11 @@ const options = githubMarkdownOpinions.init({
16
16
  'no-hard-tabs': false,
17
17
  'first-line-heading': false,
18
18
  'no-space-in-emphasis': false,
19
- 'blanks-around-fences': false
19
+ 'blanks-around-fences': false,
20
20
  })
21
21
 
22
22
  module.exports = {
23
23
  config: options,
24
24
  customRules: ['@github/markdownlint-github'],
25
- outputFormatters: [['markdownlint-cli2-formatter-pretty', {appendLink: true}]]
25
+ outputFormatters: [['markdownlint-cli2-formatter-pretty', {appendLink: true}]],
26
26
  }
package/CHANGELOG.md CHANGED
@@ -4,6 +4,8 @@
4
4
 
5
5
  ### Major Changes
6
6
 
7
+ - [#381](https://github.com/primer/eslint-plugin-primer-react/pull/381) [`52f3be6`](https://github.com/primer/eslint-plugin-primer-react/commit/52f3be6881a522b0c9b261fe5acbe0c84a7deb5a) Thanks [@copilot-swe-agent](https://github.com/apps/copilot-swe-agent)! - Upgrade to ESLint v9 support with eslint-plugin-github v6
8
+
7
9
  - [#380](https://github.com/primer/eslint-plugin-primer-react/pull/380) [`d42d5c0`](https://github.com/primer/eslint-plugin-primer-react/commit/d42d5c03a0e7df44efeed84baff2eca95af05113) Thanks [@copilot-swe-agent](https://github.com/apps/copilot-swe-agent)! - Update repository to Node.js v20
8
10
 
9
11
  ### Minor Changes
@@ -169,7 +171,6 @@
169
171
  ### Major Changes
170
172
 
171
173
  - [#174](https://github.com/primer/eslint-plugin-primer-react/pull/174) [`d9832b8`](https://github.com/primer/eslint-plugin-primer-react/commit/d9832b850cbcf808ddcdfd3efbbab7d2bf913ccd) Thanks [@langermank](https://github.com/langermank)! - - Remove `no-deprecated-colors` plugin
172
-
173
174
  - Remove dependency on `primer/primitives`
174
175
 
175
176
  - [#172](https://github.com/primer/eslint-plugin-primer-react/pull/172) [`8e24d66`](https://github.com/primer/eslint-plugin-primer-react/commit/8e24d660065b3c690a14d826580c793d7b305068) Thanks [@langermank](https://github.com/langermank)! - [Breaking] Remove `new-color-css-vars-have-fallback`
@@ -380,7 +381,6 @@
380
381
  - [#7](https://github.com/primer/eslint-plugin-primer-react/pull/7) [`d9dfb8d`](https://github.com/primer/eslint-plugin-primer-react/commit/d9dfb8de6d6dc42efe606517db7a0dd90d5c5578) Thanks [@colebemis](https://github.com/colebemis)! - Add `skipImportCheck` option. By default, the `no-deprecated-colors` rule will only check for deprecated colors used in functions and components that are imported from `@primer/react`. You can disable this behavior by setting `skipImportCheck` to `true`. This is useful for linting custom components that pass color-related props down to Primer React components.
381
382
 
382
383
  * [#6](https://github.com/primer/eslint-plugin-primer-react/pull/6) [`dd14594`](https://github.com/primer/eslint-plugin-primer-react/commit/dd14594b05e4d800baa76771f5b911d77352a983) Thanks [@colebemis](https://github.com/colebemis)! - The `no-deprecated-colors` rule can now find deprecated colors in the following cases:
383
-
384
384
  - Nested `sx` properties:
385
385
 
386
386
  ```jsx
@@ -0,0 +1,54 @@
1
+ 'use strict'
2
+
3
+ const js = require('@eslint/js')
4
+ const globals = require('globals')
5
+ const github = require('eslint-plugin-github')
6
+
7
+ /**
8
+ * @type {import('eslint').Linter.FlatConfig[]}
9
+ */
10
+ module.exports = [
11
+ {
12
+ ignores: ['node_modules/**', '.git/**'],
13
+ },
14
+ js.configs.recommended,
15
+ github.default.getFlatConfigs().recommended,
16
+ {
17
+ languageOptions: {
18
+ ecmaVersion: 'latest',
19
+ sourceType: 'commonjs',
20
+ globals: {
21
+ ...globals.commonjs,
22
+ ...globals.node,
23
+ },
24
+ },
25
+ rules: {
26
+ // Override specific rules for the repository
27
+ 'import/no-commonjs': 'off',
28
+ 'import/no-dynamic-require': 'off', // Allow dynamic requires in tests
29
+ 'no-shadow': 'off',
30
+ 'no-unused-vars': [
31
+ 'error',
32
+ {
33
+ varsIgnorePattern: '^_',
34
+ },
35
+ ],
36
+ 'github/filenames-match-regex': 'off', // Allow various file naming patterns
37
+ 'i18n-text/no-en': 'off', // Allow English text in this repository
38
+ },
39
+ },
40
+ {
41
+ files: ['**/*.test.js'],
42
+ languageOptions: {
43
+ globals: {
44
+ ...globals.jest,
45
+ },
46
+ },
47
+ },
48
+ {
49
+ files: ['eslint.config.js'],
50
+ rules: {
51
+ 'no-undef': 'off', // Allow require() in config file
52
+ },
53
+ },
54
+ ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-primer-react",
3
- "version": "8.0.0-rc.d848c88",
3
+ "version": "8.0.0",
4
4
  "description": "ESLint rules for Primer React",
5
5
  "main": "src/index.js",
6
6
  "engines": {
@@ -28,16 +28,16 @@
28
28
  },
29
29
  "homepage": "https://github.com/primer/eslint-plugin-primer-react#readme",
30
30
  "peerDependencies": {
31
- "eslint": "^8.42.0"
31
+ "eslint": "^9.0.0"
32
32
  },
33
33
  "dependencies": {
34
34
  "@styled-system/props": "^5.1.5",
35
- "eslint-plugin-github": "^5.0.1",
35
+ "@typescript-eslint/utils": "8.38.0",
36
+ "eslint-plugin-github": "^6.0.0",
36
37
  "eslint-plugin-jsx-a11y": "^6.7.1",
37
38
  "eslint-traverse": "^1.0.0",
38
39
  "lodash": "^4.17.21",
39
40
  "styled-system": "^5.1.5",
40
- "@typescript-eslint/utils": "8.38.0",
41
41
  "typescript": "^5.8.2"
42
42
  },
43
43
  "devDependencies": {
@@ -45,13 +45,19 @@
45
45
  "@changesets/cli": "^2.27.9",
46
46
  "@github/markdownlint-github": "^0.6.3",
47
47
  "@github/prettier-config": "0.0.6",
48
- "eslint": "^8.42.0",
49
- "eslint-plugin-prettier": "^5.2.1",
48
+ "@types/jest": "^30.0.0",
49
+ "@typescript-eslint/rule-tester": "8.39.0",
50
+ "eslint": "^9.0.0",
51
+ "eslint-plugin-eslint-comments": "^3.2.0",
52
+ "eslint-plugin-filenames": "^1.3.2",
53
+ "eslint-plugin-i18n-text": "^1.0.1",
54
+ "eslint-plugin-import": "^2.32.0",
55
+ "eslint-plugin-no-only-tests": "^3.3.0",
56
+ "eslint-plugin-prettier": "^5.5.4",
57
+ "globals": "^16.3.0",
50
58
  "jest": "^30.0.5",
51
59
  "markdownlint-cli2": "^0.18.1",
52
- "markdownlint-cli2-formatter-pretty": "^0.0.7",
53
- "@typescript-eslint/rule-tester": "7.16.0",
54
- "@types/jest": "^30.0.0"
60
+ "markdownlint-cli2-formatter-pretty": "^0.0.8"
55
61
  },
56
62
  "prettier": "@github/prettier-config"
57
63
  }
@@ -2,11 +2,13 @@ const rule = require('../a11y-explicit-heading')
2
2
  const {RuleTester} = require('eslint')
3
3
 
4
4
  const ruleTester = new RuleTester({
5
- parserOptions: {
5
+ languageOptions: {
6
6
  ecmaVersion: 'latest',
7
7
  sourceType: 'module',
8
- ecmaFeatures: {
9
- jsx: true,
8
+ parserOptions: {
9
+ ecmaFeatures: {
10
+ jsx: true,
11
+ },
10
12
  },
11
13
  },
12
14
  })
@@ -2,11 +2,13 @@ const rule = require('../a11y-link-in-text-block')
2
2
  const {RuleTester} = require('eslint')
3
3
 
4
4
  const ruleTester = new RuleTester({
5
- parserOptions: {
5
+ languageOptions: {
6
6
  ecmaVersion: 'latest',
7
7
  sourceType: 'module',
8
- ecmaFeatures: {
9
- jsx: true,
8
+ parserOptions: {
9
+ ecmaFeatures: {
10
+ jsx: true,
11
+ },
10
12
  },
11
13
  },
12
14
  })
@@ -2,11 +2,13 @@ const rule = require('../a11y-no-duplicate-form-labels')
2
2
  const {RuleTester} = require('eslint')
3
3
 
4
4
  const ruleTester = new RuleTester({
5
- parserOptions: {
5
+ languageOptions: {
6
6
  ecmaVersion: 'latest',
7
7
  sourceType: 'module',
8
- ecmaFeatures: {
9
- jsx: true,
8
+ parserOptions: {
9
+ ecmaFeatures: {
10
+ jsx: true,
11
+ },
10
12
  },
11
13
  },
12
14
  })
@@ -37,12 +39,6 @@ ruleTester.run('a11y-no-duplicate-form-labels', rule, {
37
39
  <TextInput />
38
40
  </FormControl>`,
39
41
 
40
- // FormControl without FormControl.Label but with aria-label is valid
41
- `import {FormControl, TextInput} from '@primer/react';
42
- <FormControl>
43
- <TextInput aria-label="Form Input Label" />
44
- </FormControl>`,
45
-
46
42
  // Multiple TextInputs with different approaches
47
43
  `import {FormControl, TextInput} from '@primer/react';
48
44
  <div>
@@ -2,11 +2,13 @@ const rule = require('../a11y-no-title-usage')
2
2
  const {RuleTester} = require('eslint')
3
3
 
4
4
  const ruleTester = new RuleTester({
5
- parserOptions: {
5
+ languageOptions: {
6
6
  ecmaVersion: 'latest',
7
7
  sourceType: 'module',
8
- ecmaFeatures: {
9
- jsx: true,
8
+ parserOptions: {
9
+ ecmaFeatures: {
10
+ jsx: true,
11
+ },
10
12
  },
11
13
  },
12
14
  })
@@ -4,11 +4,13 @@ const {RuleTester} = require('eslint')
4
4
  const rule = require('../a11y-remove-disable-tooltip')
5
5
 
6
6
  const ruleTester = new RuleTester({
7
- parserOptions: {
7
+ languageOptions: {
8
8
  ecmaVersion: 'latest',
9
9
  sourceType: 'module',
10
- ecmaFeatures: {
11
- jsx: true,
10
+ parserOptions: {
11
+ ecmaFeatures: {
12
+ jsx: true,
13
+ },
12
14
  },
13
15
  },
14
16
  })
@@ -2,11 +2,13 @@ const rule = require('../a11y-tooltip-interactive-trigger')
2
2
  const {RuleTester} = require('eslint')
3
3
 
4
4
  const ruleTester = new RuleTester({
5
- parserOptions: {
5
+ languageOptions: {
6
6
  ecmaVersion: 'latest',
7
7
  sourceType: 'module',
8
- ecmaFeatures: {
9
- jsx: true,
8
+ parserOptions: {
9
+ ecmaFeatures: {
10
+ jsx: true,
11
+ },
10
12
  },
11
13
  },
12
14
  })
@@ -2,11 +2,13 @@ const rule = require('../a11y-use-accessible-tooltip')
2
2
  const {RuleTester} = require('eslint')
3
3
 
4
4
  const ruleTester = new RuleTester({
5
- parserOptions: {
5
+ languageOptions: {
6
6
  ecmaVersion: 'latest',
7
7
  sourceType: 'module',
8
- ecmaFeatures: {
9
- jsx: true,
8
+ parserOptions: {
9
+ ecmaFeatures: {
10
+ jsx: true,
11
+ },
10
12
  },
11
13
  },
12
14
  })
@@ -2,11 +2,13 @@ const rule = require('../direct-slot-children')
2
2
  const {RuleTester} = require('eslint')
3
3
 
4
4
  const ruleTester = new RuleTester({
5
- parserOptions: {
5
+ languageOptions: {
6
6
  ecmaVersion: 'latest',
7
7
  sourceType: 'module',
8
- ecmaFeatures: {
9
- jsx: true,
8
+ parserOptions: {
9
+ ecmaFeatures: {
10
+ jsx: true,
11
+ },
10
12
  },
11
13
  },
12
14
  })
@@ -2,11 +2,13 @@ const rule = require('../enforce-button-for-link-with-nohref')
2
2
  const {RuleTester} = require('eslint')
3
3
 
4
4
  const ruleTester = new RuleTester({
5
- parserOptions: {
5
+ languageOptions: {
6
6
  ecmaVersion: 'latest',
7
7
  sourceType: 'module',
8
- ecmaFeatures: {
9
- jsx: true,
8
+ parserOptions: {
9
+ ecmaFeatures: {
10
+ jsx: true,
11
+ },
10
12
  },
11
13
  },
12
14
  })
@@ -2,11 +2,13 @@ const rule = require('../enforce-css-module-identifier-casing')
2
2
  const {RuleTester} = require('eslint')
3
3
 
4
4
  const ruleTester = new RuleTester({
5
- parserOptions: {
5
+ languageOptions: {
6
6
  ecmaVersion: 'latest',
7
7
  sourceType: 'module',
8
- ecmaFeatures: {
9
- jsx: true,
8
+ parserOptions: {
9
+ ecmaFeatures: {
10
+ jsx: true,
11
+ },
10
12
  },
11
13
  },
12
14
  })
@@ -2,11 +2,13 @@ const rule = require('../new-color-css-vars')
2
2
  const {RuleTester} = require('eslint')
3
3
 
4
4
  const ruleTester = new RuleTester({
5
- parserOptions: {
5
+ languageOptions: {
6
6
  ecmaVersion: 'latest',
7
7
  sourceType: 'module',
8
- ecmaFeatures: {
9
- jsx: true,
8
+ parserOptions: {
9
+ ecmaFeatures: {
10
+ jsx: true,
11
+ },
10
12
  },
11
13
  },
12
14
  })
@@ -4,11 +4,13 @@ const {RuleTester} = require('eslint')
4
4
  const rule = require('../no-deprecated-entrypoints')
5
5
 
6
6
  const ruleTester = new RuleTester({
7
- parserOptions: {
7
+ languageOptions: {
8
8
  ecmaVersion: 'latest',
9
9
  sourceType: 'module',
10
- ecmaFeatures: {
11
- jsx: true,
10
+ parserOptions: {
11
+ ecmaFeatures: {
12
+ jsx: true,
13
+ },
12
14
  },
13
15
  },
14
16
  })
@@ -4,11 +4,13 @@ const {RuleTester} = require('eslint')
4
4
  const rule = require('../no-deprecated-experimental-components')
5
5
 
6
6
  const ruleTester = new RuleTester({
7
- parserOptions: {
7
+ languageOptions: {
8
8
  ecmaVersion: 'latest',
9
9
  sourceType: 'module',
10
- ecmaFeatures: {
11
- jsx: true,
10
+ parserOptions: {
11
+ ecmaFeatures: {
12
+ jsx: true,
13
+ },
12
14
  },
13
15
  },
14
16
  })
@@ -4,11 +4,13 @@ const {RuleTester} = require('eslint')
4
4
  const rule = require('../no-deprecated-props')
5
5
 
6
6
  const ruleTester = new RuleTester({
7
- parserOptions: {
7
+ languageOptions: {
8
8
  ecmaVersion: 'latest',
9
9
  sourceType: 'module',
10
- ecmaFeatures: {
11
- jsx: true,
10
+ parserOptions: {
11
+ ecmaFeatures: {
12
+ jsx: true,
13
+ },
12
14
  },
13
15
  },
14
16
  })
@@ -2,11 +2,13 @@ const rule = require('../no-system-props')
2
2
  const {RuleTester} = require('eslint')
3
3
 
4
4
  const ruleTester = new RuleTester({
5
- parserOptions: {
5
+ languageOptions: {
6
6
  ecmaVersion: 'latest',
7
7
  sourceType: 'module',
8
- ecmaFeatures: {
9
- jsx: true,
8
+ parserOptions: {
9
+ ecmaFeatures: {
10
+ jsx: true,
11
+ },
10
12
  },
11
13
  },
12
14
  })
@@ -102,7 +104,6 @@ ruleTester.run('no-system-props', rule, {
102
104
  },
103
105
  {
104
106
  code: `import {Button} from '@primer/react'; <Button width={200} sx={myStylez} />`,
105
- output: `import {Button} from '@primer/react'; <Button width={200} sx={myStylez} />`,
106
107
  errors: [
107
108
  {
108
109
  messageId: 'noSystemProps',
@@ -20,10 +20,12 @@ const componentDeclaration = `const OtherComponent = ({children}: {children: Rea
20
20
  const asConstDeclaration = `const as = "p";`
21
21
 
22
22
  const ruleTester = new RuleTester({
23
- parser: '@typescript-eslint/parser',
24
- parserOptions: {
25
- tsconfigRootDir: path.resolve(__dirname, 'fixtures'),
26
- project: path.resolve(__dirname, 'fixtures', 'tsconfig.json'),
23
+ languageOptions: {
24
+ parser: require('@typescript-eslint/parser'),
25
+ parserOptions: {
26
+ tsconfigRootDir: path.resolve(__dirname, 'fixtures'),
27
+ project: path.resolve(__dirname, 'fixtures', 'tsconfig.json'),
28
+ },
27
29
  },
28
30
  defaultFilenames: {
29
31
  ts: 'file.ts',