mirror of
https://github.com/mantinedev/next-app-template.git
synced 2026-06-22 04:11:26 +10:00
Migrate eslint to oxlint (#72)
This commit is contained in:
@@ -11,7 +11,7 @@ This template comes with the following features:
|
|||||||
- [TypeScript](https://www.typescriptlang.org/)
|
- [TypeScript](https://www.typescriptlang.org/)
|
||||||
- [Storybook](https://storybook.js.org/)
|
- [Storybook](https://storybook.js.org/)
|
||||||
- [Jest](https://jestjs.io/) setup with [React Testing Library](https://testing-library.com/docs/react-testing-library/intro)
|
- [Jest](https://jestjs.io/) setup with [React Testing Library](https://testing-library.com/docs/react-testing-library/intro)
|
||||||
- ESLint setup with [eslint-config-mantine](https://github.com/mantinedev/eslint-config-mantine)
|
- Oxlint setup for TypeScript and React sources
|
||||||
|
|
||||||
## npm scripts
|
## npm scripts
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ This template comes with the following features:
|
|||||||
### Testing scripts
|
### Testing scripts
|
||||||
|
|
||||||
- `typecheck` – checks TypeScript types
|
- `typecheck` – checks TypeScript types
|
||||||
- `lint` – runs ESLint
|
- `lint` – runs oxlint and stylelint
|
||||||
- `format:test` – checks files with oxfmt
|
- `format:test` – checks files with oxfmt
|
||||||
- `jest` – runs jest tests
|
- `jest` – runs jest tests
|
||||||
- `jest:watch` – starts jest watch
|
- `jest:watch` – starts jest watch
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
import mantine from 'eslint-config-mantine';
|
|
||||||
import { defineConfig } from 'eslint/config';
|
|
||||||
import tseslint from 'typescript-eslint';
|
|
||||||
|
|
||||||
// @ts-check
|
|
||||||
export default defineConfig(
|
|
||||||
tseslint.configs.recommended,
|
|
||||||
...mantine,
|
|
||||||
{ ignores: ['**/*.{mjs,cjs,js,d.ts,d.mts}', '.next'] },
|
|
||||||
{
|
|
||||||
files: ['**/*.story.tsx'],
|
|
||||||
rules: { 'no-console': 'off' },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
languageOptions: {
|
|
||||||
parserOptions: {
|
|
||||||
tsconfigRootDir: process.cwd(),
|
|
||||||
project: ['./tsconfig.json'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
import type { OxlintConfig } from 'oxlint';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
plugins: ['react', 'typescript', 'jsx-a11y', 'jest'],
|
||||||
|
|
||||||
|
ignorePatterns: ['**/*.{mjs,cjs,js,d.ts,d.mts}', '.next', 'storybook-static'],
|
||||||
|
|
||||||
|
rules: {
|
||||||
|
'array-callback-return': 'error',
|
||||||
|
'no-duplicate-imports': 'error',
|
||||||
|
'no-var': 'error',
|
||||||
|
'no-self-compare': 'error',
|
||||||
|
'no-template-curly-in-string': 'error',
|
||||||
|
curly: 'error',
|
||||||
|
'default-case': 'off',
|
||||||
|
'default-case-last': 'error',
|
||||||
|
'no-alert': 'error',
|
||||||
|
'no-console': 'error',
|
||||||
|
'no-else-return': 'error',
|
||||||
|
'no-eval': 'error',
|
||||||
|
'no-lonely-if': 'error',
|
||||||
|
'no-multi-assign': 'error',
|
||||||
|
'no-multi-str': 'error',
|
||||||
|
'no-param-reassign': 'error',
|
||||||
|
'no-return-assign': 'error',
|
||||||
|
'no-script-url': 'error',
|
||||||
|
'no-sequences': 'error',
|
||||||
|
'no-throw-literal': 'error',
|
||||||
|
'no-unneeded-ternary': 'error',
|
||||||
|
'no-useless-call': 'error',
|
||||||
|
'no-useless-constructor': 'error',
|
||||||
|
'no-useless-return': 'error',
|
||||||
|
'operator-assignment': 'error',
|
||||||
|
'prefer-const': 'error',
|
||||||
|
'prefer-exponentiation-operator': 'error',
|
||||||
|
'prefer-object-has-own': 'error',
|
||||||
|
'prefer-object-spread': 'error',
|
||||||
|
'prefer-promise-reject-errors': 'error',
|
||||||
|
'prefer-template': 'error',
|
||||||
|
radix: 'error',
|
||||||
|
yoda: 'error',
|
||||||
|
eqeqeq: ['error', 'smart'],
|
||||||
|
'no-empty': 'off',
|
||||||
|
'no-loop-func': 'off',
|
||||||
|
'no-redeclare': 'off',
|
||||||
|
'no-undef': 'off',
|
||||||
|
'no-unused-expressions': 'off',
|
||||||
|
'no-use-before-define': 'off',
|
||||||
|
|
||||||
|
'typescript/ban-ts-comment': 'off',
|
||||||
|
'typescript/consistent-generic-constructors': 'error',
|
||||||
|
'typescript/no-deprecated': 'warn',
|
||||||
|
'typescript/no-empty-object-type': 'off',
|
||||||
|
'typescript/no-explicit-any': 'off',
|
||||||
|
'typescript/no-namespace': 'off',
|
||||||
|
'typescript/no-unsafe-function-type': 'off',
|
||||||
|
'no-unused-vars': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
args: 'all',
|
||||||
|
argsIgnorePattern: '^_',
|
||||||
|
caughtErrors: 'none',
|
||||||
|
caughtErrorsIgnorePattern: '^_',
|
||||||
|
destructuredArrayIgnorePattern: '^_',
|
||||||
|
ignoreRestSiblings: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
'react/button-has-type': 'error',
|
||||||
|
'react/jsx-boolean-value': 'error',
|
||||||
|
'react/jsx-curly-brace-presence': [
|
||||||
|
'error',
|
||||||
|
{ props: 'never', children: 'never', propElementValues: 'ignore' },
|
||||||
|
],
|
||||||
|
'react/jsx-fragments': ['error', 'syntax'],
|
||||||
|
'react/jsx-no-comment-textnodes': 'error',
|
||||||
|
'react/jsx-no-duplicate-props': 'error',
|
||||||
|
'react/jsx-no-target-blank': 'error',
|
||||||
|
'react/no-children-prop': 'error',
|
||||||
|
'react/no-find-dom-node': 'error',
|
||||||
|
'react/no-string-refs': 'error',
|
||||||
|
'react/self-closing-comp': 'error',
|
||||||
|
'react/void-dom-elements-no-children': 'error',
|
||||||
|
|
||||||
|
'jsx-a11y/anchor-has-content': 'off',
|
||||||
|
'jsx-a11y/anchor-is-valid': 'off',
|
||||||
|
'jsx-a11y/label-has-associated-control': 'off',
|
||||||
|
'jsx-a11y/mouse-events-have-key-events': 'off',
|
||||||
|
'jsx-a11y/no-autofocus': 'off',
|
||||||
|
|
||||||
|
'jest/expect-expect': 'off',
|
||||||
|
'jest/no-export': 'off',
|
||||||
|
'jest/valid-title': 'off',
|
||||||
|
},
|
||||||
|
|
||||||
|
overrides: [
|
||||||
|
{
|
||||||
|
files: ['**/*.story.tsx'],
|
||||||
|
rules: {
|
||||||
|
'no-console': 'off',
|
||||||
|
'react/button-has-type': 'off',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
} satisfies OxlintConfig;
|
||||||
+4
-12
@@ -8,8 +8,8 @@
|
|||||||
"analyze": "ANALYZE=true next build",
|
"analyze": "ANALYZE=true next build",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
"typecheck": "tsc --noEmit",
|
"typecheck": "tsc --noEmit",
|
||||||
"lint": "npm run eslint && npm run stylelint",
|
"lint": "npm run oxlint && npm run stylelint",
|
||||||
"eslint": "eslint .",
|
"oxlint": "oxlint .",
|
||||||
"stylelint": "stylelint '**/*.css' --cache",
|
"stylelint": "stylelint '**/*.css' --cache",
|
||||||
"jest": "jest",
|
"jest": "jest",
|
||||||
"jest:watch": "jest --watch",
|
"jest:watch": "jest --watch",
|
||||||
@@ -30,8 +30,6 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.28.4",
|
"@babel/core": "^7.28.4",
|
||||||
"@eslint/eslintrc": "^3",
|
|
||||||
"@eslint/js": "^9.37.0",
|
|
||||||
"@storybook/addon-themes": "^10.0.0",
|
"@storybook/addon-themes": "^10.0.0",
|
||||||
"@storybook/nextjs": "^10.0.0",
|
"@storybook/nextjs": "^10.0.0",
|
||||||
"@storybook/react": "^10.0.0",
|
"@storybook/react": "^10.0.0",
|
||||||
@@ -39,19 +37,14 @@
|
|||||||
"@testing-library/jest-dom": "^6.9.1",
|
"@testing-library/jest-dom": "^6.9.1",
|
||||||
"@testing-library/react": "^16.3.0",
|
"@testing-library/react": "^16.3.0",
|
||||||
"@testing-library/user-event": "^14.6.1",
|
"@testing-library/user-event": "^14.6.1",
|
||||||
"@types/eslint-plugin-jsx-a11y": "^6",
|
|
||||||
"@types/jest": "^30.0.0",
|
"@types/jest": "^30.0.0",
|
||||||
"@types/node": "^25.0.0",
|
"@types/node": "^25.0.0",
|
||||||
"@types/react": "19.2.14",
|
"@types/react": "19.2.14",
|
||||||
"babel-loader": "^10.0.0",
|
"babel-loader": "^10.0.0",
|
||||||
"eslint": "^9.37.0",
|
|
||||||
"eslint-config-mantine": "^4.0.3",
|
|
||||||
"eslint-config-next": "16.2.1",
|
|
||||||
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
||||||
"eslint-plugin-react": "^7.37.5",
|
|
||||||
"jest": "^30.2.0",
|
"jest": "^30.2.0",
|
||||||
"jest-environment-jsdom": "^30.2.0",
|
"jest-environment-jsdom": "^30.2.0",
|
||||||
"oxfmt": "^0.42.0",
|
"oxfmt": "^0.42.0",
|
||||||
|
"oxlint": "^1.58.0",
|
||||||
"postcss": "^8.5.6",
|
"postcss": "^8.5.6",
|
||||||
"postcss-preset-mantine": "1.18.0",
|
"postcss-preset-mantine": "1.18.0",
|
||||||
"postcss-simple-vars": "^7.0.1",
|
"postcss-simple-vars": "^7.0.1",
|
||||||
@@ -59,8 +52,7 @@
|
|||||||
"stylelint": "^17.0.0",
|
"stylelint": "^17.0.0",
|
||||||
"stylelint-config-standard-scss": "^17.0.0",
|
"stylelint-config-standard-scss": "^17.0.0",
|
||||||
"ts-jest": "^29.4.4",
|
"ts-jest": "^29.4.4",
|
||||||
"typescript": "6.0.2",
|
"typescript": "6.0.2"
|
||||||
"typescript-eslint": "^8.46.0"
|
|
||||||
},
|
},
|
||||||
"packageManager": "yarn@4.13.0"
|
"packageManager": "yarn@4.13.0"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user