Skip to content

Commit 15c53ec

Browse files
authored
import type from eslint to avoid silly errors like #13 (#15)
1 parent 6cfbc59 commit 15c53ec

File tree

7 files changed

+26
-10
lines changed

7 files changed

+26
-10
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
node-version-file: ".nvmrc"
1717
cache: "pnpm"
1818
- run: pnpm install --frozen-lockfile
19-
- run: (cd packages/eslint-react-prefer-function-component && pnpm package:build)
19+
- run: (cd packages/eslint-plugin-react-prefer-function-component && pnpm package:build)
2020
# run again to link bin that is now available after package:build
2121
- run: pnpm install --frozen-lockfile
2222
- run: pnpm lint

.github/workflows/publish.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
cache: "pnpm"
1515
registry-url: "https://registry.npmjs.org"
1616
- run: pnpm install --frozen-lockfile
17-
- run: cp README.md LICENSE CHANGELOG.md packages/eslint-react-prefer-function-component
18-
- run: cd packages/eslint-react-prefer-function-component && pnpm package:build && npm publish
17+
- run: cp README.md LICENSE CHANGELOG.md packages/eslint-plugin-react-prefer-function-component
18+
- run: cd packages/eslint-plugin-react-prefer-function-component && pnpm package:build && npm publish
1919
env:
2020
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

CHANGELOG.md

+13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# Changelog
22

3+
## v3.2.0
4+
5+
- The plugin's recommended configuration has been fixed, so `plugins` can be dropped from your `.eslintrc` when using the recommended settings:
6+
7+
```diff
8+
module.exports = {
9+
- plugins: ["react-prefer-function-component"],
10+
extends: ["plugin:react-prefer-function-component/recommended"],
11+
};
12+
13+
Thanks @alecmev!
14+
```
15+
316
## v3.1.0
417

518
- New option: `allowJsxUtilityClass`. This configuration option permits JSX utility classes: classes that have methods that return JSX but are not themselves components(they do not extend from a Component class or have a render method).

examples/recommended-config/.eslintrc.js

-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,5 @@ module.exports = {
77
jsx: true,
88
},
99
},
10-
plugins: ["react-prefer-function-component"],
1110
extends: ["plugin:react-prefer-function-component/recommended"],
1211
};

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
"lint:fix:package": "prettier-package-json --write package.json",
1919
"prepare": "husky install",
2020
"test": "pnpm jest",
21-
"test:ci": "pnpm test --coverage",
22-
"typecheck": "pnpm tsc --noEmit"
21+
"test:ci": "pnpm jest --coverage",
22+
"typecheck": "pnpm run --recursive typecheck"
2323
},
2424
"devDependencies": {
2525
"@babel/preset-env": "^7.22.9",

packages/eslint-plugin-react-prefer-function-component/package.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eslint-plugin-react-prefer-function-component",
3-
"version": "3.1.0",
3+
"version": "3.2.0",
44
"description": "ESLint plugin that prevents the use of JSX class components",
55
"license": "MIT",
66
"author": "Tate <[email protected]>",
@@ -12,12 +12,13 @@
1212
"bugs": {
1313
"url": "https://github.com/tatethurston/eslint-plugin-react-prefer-function-component/issues"
1414
},
15-
"main": "index.js",
15+
"main": "dist/index.js",
1616
"scripts": {
1717
"build": "pnpm clean && pnpm tsc",
1818
"clean": "rm -rf dist/*",
1919
"package:build": "pnpm build && pnpm package:prune",
20-
"package:prune": "find dist -name test.* -delete"
20+
"package:prune": "find dist -name test.* -delete",
21+
"typecheck": "tsc --noEmit"
2122
},
2223
"types": "index.d.ts",
2324
"keywords": [

packages/eslint-plugin-react-prefer-function-component/src/index.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
import type { ESLint } from "eslint";
12
import PreferFunctionComponent from "./prefer-function-component";
23

3-
module.exports = {
4+
const plugin: ESLint.Plugin = {
45
configs: {
56
recommended: {
67
plugins: ["react-prefer-function-component"],
@@ -14,3 +15,5 @@ module.exports = {
1415
"react-prefer-function-component": PreferFunctionComponent,
1516
},
1617
};
18+
19+
module.exports = plugin;

0 commit comments

Comments
 (0)