Skip to content

Commit f8de86f

Browse files
committed
fixing merge conflicts
2 parents 53ee102 + 00bb082 commit f8de86f

File tree

15 files changed

+1009
-26
lines changed

15 files changed

+1009
-26
lines changed

.vscode/launch.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535
"cwd": "${workspaceFolder}",
3636
"program": "${workspaceFolder}/node_modules/.bin/jest",
3737
"args": [
38-
"packages/code-analyzer-eslint-engine/test/engine.test.ts",
38+
"packages/code-analyzer-eslint-engine/test/rule-mappings.test.ts",
3939
"-t",
40-
"When file_extensions is only .tsx, then only react rules are returned",
40+
"Test that the list of all bundled rules matches our RULE_MAPPINGS list",
4141
"--runInBand",
4242
"--coverage=false"
4343
],

package-lock.json

Lines changed: 123 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/code-analyzer-eslint-engine/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"eslint-plugin-import": "^2.32.0",
3030
"eslint-plugin-jest": "^29.12.1",
3131
"eslint-plugin-react": "^7.37.5",
32+
"eslint-plugin-jsx-a11y": "^6.10.2",
3233
"eslint-plugin-react-hooks": "^7.0.1",
3334
"globals": "^17.0.0",
3435
"semver": "^7.7.3",
@@ -79,4 +80,4 @@
7980
"!src/index.ts"
8081
]
8182
}
82-
}
83+
}

packages/code-analyzer-eslint-engine/src/base-config.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import salesforceEslintConfigLwc from "@salesforce/eslint-config-lwc";
66
import sldsEslintPlugin from "@salesforce-ux/eslint-plugin-slds";
77
import eslintPluginReact from "eslint-plugin-react";
88
import eslintPluginReactHooks from "eslint-plugin-react-hooks";
9+
import eslintPluginJsxA11y from "eslint-plugin-jsx-a11y";
910
import {ESLintEngineConfig} from "./config";
1011
import globals from "globals";
1112

@@ -230,6 +231,8 @@ export class BaseConfigFactory {
230231
// These rules are not needed for React 17+ which is now the standard (released Oct 2020)
231232
const jsxRuntimeConfig = eslintPluginReact.configs.flat['jsx-runtime'];
232233

234+
235+
233236
return [
234237
// React all rules config
235238
{
@@ -259,6 +262,11 @@ export class BaseConfigFactory {
259262
'react-hooks/rules-of-hooks': 'error',
260263
'react-hooks/exhaustive-deps': 'warn'
261264
}
265+
},
266+
// jsx-a11y plugin config
267+
{
268+
...eslintPluginJsxA11y.flatConfigs?.strict,
269+
files: filePatterns
262270
}
263271
];
264272
}

packages/code-analyzer-eslint-engine/src/missing-types-for-dependencies.d.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,34 @@ declare module '@lwc/eslint-plugin-lwc-platform' {
1515
export = plugin;
1616
}
1717

18+
// This declaration adds in the missing types for "eslint-plugin-jsx-a11y"
19+
declare module 'eslint-plugin-jsx-a11y' {
20+
import type { ESLint, Linter } from 'eslint';
21+
import type { RuleDefinition } from '@eslint/core';
22+
23+
const plugin: ESLint.Plugin & {
24+
readonly rules: Record<string, RuleDefinition>;
25+
26+
// Newer flat API (some versions)
27+
readonly configs?: {
28+
readonly flat?: {
29+
readonly recommended: Linter.Config;
30+
readonly strict: Linter.Config;
31+
};
32+
// Some versions expose this key instead
33+
readonly 'flat/recommended'?: Linter.Config;
34+
readonly 'flat/strict'?: Linter.Config;
35+
};
36+
37+
// Some versions expose flat configs here
38+
readonly flatConfigs?: {
39+
readonly recommended: Linter.Config;
40+
readonly strict: Linter.Config;
41+
};
42+
};
43+
export = plugin;
44+
}
45+
1846
// This declaration adds in the missing types for "@salesforce/eslint-config-lwc" whose package.json file's main field points to:
1947
// node_modules/@salesforce/eslint-config-lwc/index.js
2048
declare module '@salesforce/eslint-config-lwc' {

packages/code-analyzer-eslint-engine/src/rule-mappings.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {RULE_MAPPINGS_TYPESCRIPT_ESLINT} from "./rule-mappings/typescript-eslint
55
import {RULE_MAPPINGS_SLDS_HTML} from "./rule-mappings/slds-html";
66
import {RULE_MAPPINGS_SLDS_CSS} from "./rule-mappings/slds-css";
77
import {RULE_MAPPINGS_REACT} from "./rule-mappings/react";
8+
import {RULE_MAPPINGS_REACT_A11Y} from "./rule-mappings/react-jsx-a11y";
89

910
export const RULE_MAPPINGS: Record<string, {severity: SeverityLevel, tags: string[]}> = {
1011
...RULE_MAPPINGS_ESLINT_BASE,
@@ -13,4 +14,5 @@ export const RULE_MAPPINGS: Record<string, {severity: SeverityLevel, tags: strin
1314
...RULE_MAPPINGS_SLDS_HTML,
1415
...RULE_MAPPINGS_SLDS_CSS,
1516
...RULE_MAPPINGS_REACT,
17+
...RULE_MAPPINGS_REACT_A11Y,
1618
};

packages/code-analyzer-eslint-engine/src/rule-mappings/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
export const LWC = "LWC";
33
export const SLDS = "SLDS";
44
export const REACT = "React";
5+
export const A11Y = "A11y";

0 commit comments

Comments
 (0)