Skip to content

Commit

Permalink
import type from eslint to avoid silly errors like #13 (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
tatethurston authored Aug 2, 2023
1 parent 6cfbc59 commit 15c53ec
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
node-version-file: ".nvmrc"
cache: "pnpm"
- run: pnpm install --frozen-lockfile
- run: (cd packages/eslint-react-prefer-function-component && pnpm package:build)
- run: (cd packages/eslint-plugin-react-prefer-function-component && pnpm package:build)
# run again to link bin that is now available after package:build
- run: pnpm install --frozen-lockfile
- run: pnpm lint
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
cache: "pnpm"
registry-url: "https://registry.npmjs.org"
- run: pnpm install --frozen-lockfile
- run: cp README.md LICENSE CHANGELOG.md packages/eslint-react-prefer-function-component
- run: cd packages/eslint-react-prefer-function-component && pnpm package:build && npm publish
- run: cp README.md LICENSE CHANGELOG.md packages/eslint-plugin-react-prefer-function-component
- run: cd packages/eslint-plugin-react-prefer-function-component && pnpm package:build && npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## v3.2.0

- The plugin's recommended configuration has been fixed, so `plugins` can be dropped from your `.eslintrc` when using the recommended settings:

```diff
module.exports = {
- plugins: ["react-prefer-function-component"],
extends: ["plugin:react-prefer-function-component/recommended"],
};

Thanks @alecmev!
```

## v3.1.0

- 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).
Expand Down
1 change: 0 additions & 1 deletion examples/recommended-config/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ module.exports = {
jsx: true,
},
},
plugins: ["react-prefer-function-component"],
extends: ["plugin:react-prefer-function-component/recommended"],
};
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"lint:fix:package": "prettier-package-json --write package.json",
"prepare": "husky install",
"test": "pnpm jest",
"test:ci": "pnpm test --coverage",
"typecheck": "pnpm tsc --noEmit"
"test:ci": "pnpm jest --coverage",
"typecheck": "pnpm run --recursive typecheck"
},
"devDependencies": {
"@babel/preset-env": "^7.22.9",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-react-prefer-function-component",
"version": "3.1.0",
"version": "3.2.0",
"description": "ESLint plugin that prevents the use of JSX class components",
"license": "MIT",
"author": "Tate <tatethurston@gmail.com>",
Expand All @@ -12,12 +12,13 @@
"bugs": {
"url": "https://github.com/tatethurston/eslint-plugin-react-prefer-function-component/issues"
},
"main": "index.js",
"main": "dist/index.js",
"scripts": {
"build": "pnpm clean && pnpm tsc",
"clean": "rm -rf dist/*",
"package:build": "pnpm build && pnpm package:prune",
"package:prune": "find dist -name test.* -delete"
"package:prune": "find dist -name test.* -delete",
"typecheck": "tsc --noEmit"
},
"types": "index.d.ts",
"keywords": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { ESLint } from "eslint";
import PreferFunctionComponent from "./prefer-function-component";

module.exports = {
const plugin: ESLint.Plugin = {
configs: {
recommended: {
plugins: ["react-prefer-function-component"],
Expand All @@ -14,3 +15,5 @@ module.exports = {
"react-prefer-function-component": PreferFunctionComponent,
},
};

module.exports = plugin;

0 comments on commit 15c53ec

Please sign in to comment.