Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,21 +75,31 @@ import tseslint from "typescript-eslint";

export default tseslint.config({
files: ["**/*.ts", "**/*.tsx"],

// Extend recommended rule sets from:
// 1. ESLint JS's recommended rules
// 2. TypeScript ESLint recommended rules
// 3. ESLint React's recommended-typescript rules
extends: [
eslintJs.configs.recommended,
tseslint.configs.recommended,
eslintReact.configs["recommended-typescript"],
],

// Configure language/parsing options
languageOptions: {
// Use TypeScript ESLint parser for TypeScript files
parser: tseslint.parser,
parserOptions: {
// Enable project service for better TypeScript integration
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},

// Custom rule overrides (modify rule levels or disable rules)
rules: {
// Put rules you want to override here
"@eslint-react/no-class-component": "error",
"@eslint-react/no-missing-key": "warn",
},
});
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ export default [
},
{
files: ["**/*.js", "**/*.jsx"],
// Custom rule overrides (modify rule levels or disable rules)
rules: {
// Put rules you want to override here
"@eslint-react/no-class-component": "error",
"@eslint-react/no-missing-key": "warn",
},
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import globals from "globals";
const GLOB_TS = ["**/*.ts", "**/*.tsx"];

export default [
// base configuration for browser environment source files
{
files: GLOB_TS,
languageOptions: {
Expand All @@ -45,7 +44,6 @@ export default [
...eslintJs.configs.recommended.rules,
},
},
// React configuration
{
files: GLOB_TS,
...eslintReact.configs["recommended-typescript"],
Expand Down
6 changes: 3 additions & 3 deletions apps/website/content/docs/getting-started/javascript.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default defineConfig([

// Custom rule overrides (modify rule levels or disable rules)
rules: {
"@eslint-react/no-class-component": "error",
"@eslint-react/no-missing-key": "warn",
},
},
]);
Expand Down Expand Up @@ -92,9 +92,9 @@ export default [
{
"compilerOptions": {
// ...other options
"jsx": "react-jsx",
"jsx": "react-jsx"
},
"include": ["**/*.js", "**/*.jsx"],
"include": ["**/*.js", "**/*.jsx"]
}
```

Expand Down
13 changes: 9 additions & 4 deletions apps/website/content/docs/getting-started/typescript.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ export default tseslint.config({
// 1. ESLint JS's recommended rules
// 2. TypeScript ESLint recommended rules
// 3. ESLint React's recommended-typescript rules
extends: [eslintJs.configs.recommended, tseslint.configs.recommended, eslintReact.configs["recommended-typescript"]],
extends: [
eslintJs.configs.recommended,
tseslint.configs.recommended,
eslintReact.configs["recommended-typescript"],
],

// Configure language/parsing options
languageOptions: {
Expand All @@ -51,12 +55,13 @@ export default tseslint.config({
parserOptions: {
// Enable project service for better TypeScript integration
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},

// Custom rule overrides (modify rule levels or disable rules)
rules: {
"@eslint-react/no-class-component": "error",
"@eslint-react/no-missing-key": "warn",
},
});
```
Expand Down Expand Up @@ -88,9 +93,9 @@ export default [
{
"compilerOptions": {
// ...other options
"jsx": "react-jsx",
"jsx": "react-jsx"
},
"include": ["**/*.ts", "**/*.tsx"],
"include": ["**/*.ts", "**/*.tsx"]
}
```

Expand Down
14 changes: 12 additions & 2 deletions packages/plugins/eslint-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,21 +75,31 @@ import tseslint from "typescript-eslint";

export default tseslint.config({
files: ["**/*.ts", "**/*.tsx"],

// Extend recommended rule sets from:
// 1. ESLint JS's recommended rules
// 2. TypeScript ESLint recommended rules
// 3. ESLint React's recommended-typescript rules
extends: [
eslintJs.configs.recommended,
tseslint.configs.recommended,
eslintReact.configs["recommended-typescript"],
],

// Configure language/parsing options
languageOptions: {
// Use TypeScript ESLint parser for TypeScript files
parser: tseslint.parser,
parserOptions: {
// Enable project service for better TypeScript integration
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},

// Custom rule overrides (modify rule levels or disable rules)
rules: {
// Put rules you want to override here
"@eslint-react/no-class-component": "error",
"@eslint-react/no-missing-key": "warn",
},
});
```
Expand Down
5 changes: 5 additions & 0 deletions packages/plugins/eslint-plugin/src/configs/all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,13 @@ export const rules = {
"@eslint-react/no-duplicate-key": "warn",
"@eslint-react/no-forward-ref": "warn",
"@eslint-react/no-implicit-key": "warn",
// "@eslint-react/no-leaked-conditional-rendering": "warn",
"@eslint-react/no-missing-component-display-name": "warn",
"@eslint-react/no-missing-context-display-name": "warn",
"@eslint-react/no-missing-key": "error",
"@eslint-react/no-misused-capture-owner-stack": "error",
"@eslint-react/no-nested-component-definitions": "error",
"@eslint-react/no-nested-lazy-component-declarations": "warn",
"@eslint-react/no-prop-types": "error",
"@eslint-react/no-redundant-should-component-update": "error",
"@eslint-react/no-set-state-in-component-did-mount": "warn",
Expand All @@ -59,6 +62,8 @@ export const rules = {
"@eslint-react/no-useless-forward-ref": "warn",
"@eslint-react/no-useless-fragment": "warn",
"@eslint-react/prefer-destructuring-assignment": "warn",
"@eslint-react/prefer-react-namespace-import": "warn",
// "@eslint-react/prefer-read-only-props": "warn",
"@eslint-react/prefer-shorthand-boolean": "off",
"@eslint-react/prefer-shorthand-fragment": "off",

Expand Down
1 change: 1 addition & 0 deletions packages/plugins/eslint-plugin/src/configs/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const rules = {
"@eslint-react/debug/function-component": "warn",
"@eslint-react/debug/hook": "warn",
"@eslint-react/debug/is-from-react": "warn",
"@eslint-react/debug/jsx": "warn",
} as const;

export const plugins = {
Expand Down
Loading