Skip to content

Commit

Permalink
feat: add a11y
Browse files Browse the repository at this point in the history
  • Loading branch information
Rei-x committed Dec 3, 2024
1 parent ce008ea commit dd39a2e
Show file tree
Hide file tree
Showing 8 changed files with 154 additions and 9 deletions.
2 changes: 1 addition & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// eslint-disable-next-line antfu/no-import-dist
import { solvro } from "./dist/eslint-config/index.js";
import { solvro } from "./dist/eslint/index.js";

export default solvro([
{
Expand Down
11 changes: 11 additions & 0 deletions eslint/configs/a11y.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type { Linter } from "eslint";
import jsxA11y from "eslint-plugin-jsx-a11y";

export function a11y(): Linter.Config[] {
return [

Check failure on line 5 in eslint/configs/a11y.ts

View workflow job for this annotation

GitHub Actions / Lint

Unsafe return of a value of type `any[]`
{
...jsxA11y.flatConfigs.strict,

Check failure on line 7 in eslint/configs/a11y.ts

View workflow job for this annotation

GitHub Actions / Lint

Unsafe member access .flatConfigs on an `any` value
name: "solvro/a11y/rules",
},
];
}
4 changes: 0 additions & 4 deletions eslint/configs/javascript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,6 @@ export function javascript(): Linter.Config[] {
vars: "all",
},
],
"no-use-before-define": [
"error",
{ classes: false, functions: false, variables: true },
],
"no-useless-backreference": "error",
"no-useless-call": "error",
"no-useless-catch": "error",
Expand Down
10 changes: 10 additions & 0 deletions eslint/configs/unicorn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ export function unicorn(): Linter.Config[] {
...pluginUnicorn.configs["flat/recommended"].rules,
"unicorn/no-array-reduce": "off",
"unicorn/no-null": "off",
"unicorn/no-useless-switch-case": "off",
"unicorn/prevent-abbreviations": [
"error",
{
replacements: {
env: false,
envs: false,
},
},
],
},
},
];
Expand Down
10 changes: 7 additions & 3 deletions eslint/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { isPackageExists } from "local-pkg";
import tseslint from "typescript-eslint";
import type { ConfigWithExtends } from "typescript-eslint";

import { a11y } from "./configs/a11y";
import { comments } from "./configs/comments";
import { disables } from "./configs/disables";
import { formatters } from "./configs/formatters";
Expand All @@ -18,7 +19,7 @@ import { unicorn } from "./configs/unicorn";
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call
const adonisConfig = [...configApp(), ...node()];

const nextjsConfig = [...react()];
const nextjsConfig = [...react(), ...a11y()];

export const solvro = (...overrides: ConfigWithExtends[]) => {
const isAdonis = isPackageExists("@adonisjs/core");
Expand All @@ -29,11 +30,14 @@ export const solvro = (...overrides: ConfigWithExtends[]) => {
...javascript(),
...jsdoc(),
...unicorn(),
...disables(),
...imports(),
...comments(),
];

const defaultOverrides = [
...ignores(),
...formatters(),
...disables(),
...overrides,
];

Expand All @@ -52,5 +56,5 @@ export const solvro = (...overrides: ConfigWithExtends[]) => {
configs.push(...nextjsConfig);
}

return tseslint.config(configs);
return tseslint.config(configs, ...defaultOverrides);
};
1 change: 1 addition & 0 deletions eslint/stub.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
declare module "eslint-plugin-react-hooks";
declare module "eslint-plugin-react-refresh";
declare module "@adonisjs/eslint-config";
declare module "eslint-plugin-jsx-a11y";
124 changes: 123 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-import-x": "^4.4.3",
"eslint-plugin-jsdoc": "^50.6.0",
"eslint-plugin-jsx-a11y": "^6.10.2",
"eslint-plugin-n": "^17.14.0",
"eslint-plugin-no-only-tests": "^3.3.0",
"eslint-plugin-perfectionist": "^4.1.2",
Expand Down

0 comments on commit dd39a2e

Please sign in to comment.