File tree Expand file tree Collapse file tree 11 files changed +1696
-5
lines changed Expand file tree Collapse file tree 11 files changed +1696
-5
lines changed Original file line number Diff line number Diff line change 3131 with :
3232 fail_ci_if_error : true
3333 token : ${{ secrets.CODECOV_TOKEN }}
34+ e2e-legacy-config :
35+ name : E2E Legacy Config
36+ runs-on : ubuntu-latest
37+ steps :
38+ - uses : tatethurston/github-actions/build@main
39+ - name : pnpm eslint
40+ run : |
41+ cd packages/legacy-config
42+ pnpm eslint index.jsx
43+ output="tate" # $(pnpm eslint index.jsx)
44+ echo "$output"
45+
46+ expected="Class component should be written as a function react-prefer-function-component/react-prefer-function-component"
47+ if [[ "$output" != *"$expected"* ]]; then
48+ echo "❌ Fail"
49+ else
50+ echo "✅ Pass"
51+ fi
52+ e2e-flat-config :
53+ name : E2E Flat Config
54+ runs-on : ubuntu-latest
55+ steps :
56+ - uses : tatethurston/github-actions/build@main
57+ - name : pnpm eslint
58+ run : |
59+ cd packages/flat-config
60+ output="tate" #$(pnpm eslint index.jsx)
61+ echo "$output"
62+
63+ expected="Class component should be written as a function react-prefer-function-component/react-prefer-function-component"
64+ if [[ "$output" != *"$expected"* ]]; then
65+ echo "❌ Fail"
66+ # exit 1
67+ else
68+ echo "✅ Pass"
69+ fi
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ /** @type {import('jest').Config } */
2+ export default {
3+ clearMocks : true ,
4+ coverageDirectory : "coverage" ,
5+ testEnvironment : "node" ,
6+ // TS ESM imports are referenced with .js extensions, but jest will fail to find
7+ // the uncompiled file because it ends with .ts and is looking for .js.
8+ moduleNameMapper : {
9+ "(.+)\\.jsx?" : "$1" ,
10+ "(.+)\\.mjs" : "$1.mts" ,
11+ } ,
12+ transform : {
13+ "^.+\\.(ts|tsx|js|jsx|mjs|mts)$" : "babel-jest" ,
14+ } ,
15+ } ;
Original file line number Diff line number Diff line change 1+ import preferFunctionComponent from "eslint-plugin-react-prefer-function-component/config" ;
2+
3+ export default [
4+ {
5+ files : [ "*.jsx" ] ,
6+ languageOptions : {
7+ parserOptions : {
8+ ecmaVersion : "latest" ,
9+ sourceType : "module" ,
10+ ecmaFeatures : {
11+ jsx : true ,
12+ } ,
13+ } ,
14+ } ,
15+ } ,
16+ preferFunctionComponent . configs . recommended ,
17+ ] ;
Original file line number Diff line number Diff line change 1+ import { Component } from "react" ;
2+
3+ export class Foo extends Component {
4+ render ( ) {
5+ return < div > { this . props . foo } </ div > ;
6+ }
7+ }
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " flat-config" ,
3+ "type" : " module" ,
4+ "version" : " 1.0.0" ,
5+ "description" : " " ,
6+ "main" : " index.js" ,
7+ "scripts" : {
8+ "test" : " echo \" Error: no test specified\" && exit 1"
9+ },
10+ "keywords" : [],
11+ "author" : " " ,
12+ "license" : " ISC" ,
13+ "devDependencies" : {
14+ "eslint" : " ^9.22.0" ,
15+ "eslint-plugin-react-prefer-function-component" : " workspace:^"
16+ }
17+ }
Original file line number Diff line number Diff line change 1+ // eslint-disable-next-line no-undef
2+ module . exports = {
3+ parserOptions : {
4+ ecmaVersion : "latest" ,
5+ sourceType : "module" ,
6+ ecmaFeatures : {
7+ jsx : true ,
8+ } ,
9+ } ,
10+ extends : [ "plugin:react-prefer-function-component/recommended" ] ,
11+ } ;
Original file line number Diff line number Diff line change 1+ import { Component } from "react" ;
2+
3+ export class Foo extends Component {
4+ render ( ) {
5+ return < div > { this . props . foo } </ div > ;
6+ }
7+ }
You can’t perform that action at this time.
0 commit comments