Skip to content

Commit

Permalink
feat: adonis specific ts config
Browse files Browse the repository at this point in the history
  • Loading branch information
Rei-x committed Dec 3, 2024
1 parent 66741bf commit b6f567a
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 8 deletions.
2 changes: 2 additions & 0 deletions eslint/configs/a11y.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import type { Linter } from "eslint";
import jsxA11y from "eslint-plugin-jsx-a11y";

export function a11y(): Linter.Config[] {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return [
{
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
...jsxA11y.flatConfigs.strict,
name: "solvro/a11y/rules",
},
Expand Down
5 changes: 5 additions & 0 deletions eslint/configs/disables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ export function disables(): Linter.Config[] {
"@typescript-eslint/explicit-function-return-type": "off",
},
},
{
rules: {
"prettier/prettier": "off",
},
},
{
files: [`**/cli/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
name: "solvro/disables/cli",
Expand Down
3 changes: 0 additions & 3 deletions eslint/configs/javascript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ export function javascript(): Linter.Config[] {
"error",
{ enforceForClassMembers: true, setWithoutGet: true },
],

"antfu/no-top-level-await": "error",
"array-callback-return": "error",
"block-scoped-var": "error",
"constructor-super": "error",
Expand Down Expand Up @@ -146,7 +144,6 @@ export function javascript(): Linter.Config[] {
"no-template-curly-in-string": "error",
"no-this-before-super": "error",
"no-throw-literal": "error",
"no-undef": "error",
"no-undef-init": "error",
"no-unexpected-multiline": "error",
"no-unmodified-loop-condition": "error",
Expand Down
21 changes: 21 additions & 0 deletions eslint/configs/typescript-adonis.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { Linter } from "eslint";
import tseslint from "typescript-eslint";

export function typescriptAdonis(): Linter.Config[] {
return [
...tseslint.configs.recommendedTypeChecked,
...tseslint.configs.stylisticTypeChecked,
{
rules: {
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/require-await": "off",
"@typescript-eslint/no-misused-promises": [
"error",
{
checksVoidReturn: false,
},
],
},
},
] as Linter.Config[];
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import tseslint from "typescript-eslint";

import { pluginAntfu } from "../plugins";

export function typescript(): Linter.Config[] {
export function typescriptNext(): Linter.Config[] {
return [
// @ts-expect-error ???
tseslint.configs.strictTypeChecked,
Expand Down
15 changes: 11 additions & 4 deletions eslint/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,26 @@ import { javascript } from "./configs/javascript";
import { jsdoc } from "./configs/jsdoc";
import { node } from "./configs/node";
import { react } from "./configs/react";
import { typescript } from "./configs/typescript";
import { typescriptAdonis } from "./configs/typescript-adonis";
import { typescriptNext } from "./configs/typescript-next";
import { unicorn } from "./configs/unicorn";

// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call
const adonisConfig = [...configApp(), ...node()];
const adonisConfig = [...configApp(), ...node(), ...typescriptAdonis()];

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

export const solvro = (...overrides: ConfigWithExtends[]) => {
const isAdonis = isPackageExists("@adonisjs/core");
const isNext = isPackageExists("next");

const configs = [...typescript(), ...javascript(), ...jsdoc(), ...comments()];
const configs = [...javascript(), ...jsdoc(), ...comments()];

const defaultOverrides = [
...ignores(),
Expand Down

0 comments on commit b6f567a

Please sign in to comment.