File tree 11 files changed +1695
-5
lines changed
11 files changed +1695
-5
lines changed Original file line number Diff line number Diff line change 31
31
with :
32
32
fail_ci_if_error : true
33
33
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
+ output=$(pnpm eslint index.jsx || true)
43
+ echo "$output"
44
+
45
+ expected="Class component should be written as a function react-prefer-function-component/react-prefer-function-component"
46
+ if [[ "$output" != *"$expected"* ]]; then
47
+ echo "❌ Fail"
48
+ else
49
+ echo "✅ Pass"
50
+ fi
51
+ e2e-flat-config :
52
+ name : E2E Flat Config
53
+ runs-on : ubuntu-latest
54
+ steps :
55
+ - uses : tatethurston/github-actions/build@main
56
+ - name : pnpm eslint
57
+ run : |
58
+ cd packages/flat-config
59
+ output=$(pnpm eslint index.jsx || true)
60
+ echo "$output"
61
+
62
+ expected="Class component should be written as a function react-prefer-function-component/react-prefer-function-component"
63
+ if [[ "$output" != *"$expected"* ]]; then
64
+ echo "❌ Fail"
65
+ # exit 1
66
+ else
67
+ echo "✅ Pass"
68
+ 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