Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
15c53ec
commit 48caca6
Showing
13 changed files
with
1,253 additions
and
970 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import eslint from "@eslint/js"; | ||
import reactRecommended from "eslint-plugin-react/configs/recommended.js"; | ||
import preferFC from "eslint-plugin-react-prefer-function-component/config"; | ||
|
||
export default [ | ||
{ files: ["**/*.{js,jsx}"] }, | ||
eslint.configs.recommended, | ||
reactRecommended, | ||
preferFC.configs.recommended, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React, { Component } from "react"; | ||
|
||
export class Foo extends Component { | ||
render() { | ||
return <div>{this.props.foo}</div>; | ||
} | ||
} | ||
|
||
export const Bar = function (props) { | ||
return <div>{props.foo}</div>; | ||
}; | ||
|
||
export function Baz(props) { | ||
return <div>{props.foo}</div>; | ||
} | ||
|
||
export class ErrorBoundary extends Component { | ||
componentDidCatch(error, errorInfo) { | ||
logErrorToMyService(error, errorInfo); | ||
} | ||
|
||
render() { | ||
return <div>{this.props.foo}</div>; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"version": "1.0.0", | ||
"type": "module", | ||
"description": "", | ||
"name": "flat-config", | ||
"scripts": { | ||
"lint": "eslint ." | ||
}, | ||
"author": "Tate Thurston <tatethurston@gmail.com>", | ||
"license": "ISC", | ||
"main": "index.js", | ||
"devDependencies": { | ||
"eslint": "^8.48.0", | ||
"eslint-plugin-react": "^7.33.2", | ||
"eslint-plugin-react-prefer-function-component": "workspace:*" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
packages/eslint-plugin-react-prefer-function-component/src/config.mts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import type { ESLint } from "eslint"; | ||
import preferFunctionComponent from "./prefer-function-component/index.js"; | ||
|
||
const plugin: ESLint.Plugin = { | ||
rules: { | ||
"prefer-function-component": preferFunctionComponent.default, | ||
}, | ||
}; | ||
|
||
const config: ESLint.Plugin = { | ||
configs: { | ||
recommended: { | ||
plugins: { | ||
"prefer-function-component": plugin, | ||
}, | ||
rules: { | ||
"prefer-function-component/prefer-function-component": "error", | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export default config; |
2 changes: 1 addition & 1 deletion
2
packages/eslint-plugin-react-prefer-function-component/src/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.