Skip to content

Commit

Permalink
chore: test new lintstaged rules (heroui-inc#1050)
Browse files Browse the repository at this point in the history
  • Loading branch information
tianenpang authored Feb 18, 2023
1 parent a6d8b97 commit de1556e
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 56 deletions.
5 changes: 4 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"plugin:react-hooks/recommended",
"plugin:jsx-a11y/recommended"
],
"plugins": ["react", "prettier", "import", "@typescript-eslint", "jsx-a11y"],
"plugins": ["react", "unused-imports", "import", "@typescript-eslint", "jsx-a11y", "prettier"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
Expand All @@ -34,6 +34,9 @@
"jsx-a11y/click-events-have-key-events": "warn",
"jsx-a11y/interactive-supports-focus": "warn",
"prettier/prettier": "warn",
"no-unused-vars": "off",
"unused-imports/no-unused-vars": "off",
"unused-imports/no-unused-imports": "warn",
"@typescript-eslint/no-unused-vars": [
"warn",
{
Expand Down
14 changes: 6 additions & 8 deletions .lintstagedrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,14 @@ const removeIgnoredFiles = async (files) => {
};

module.exports = {
// *.!(js|ts|jsx|tsx|d.ts)
"./packages/**/**/*.{js,cjs,mjs,ts,jsx,tsx,json,md}": async (files) => {
"**/*.{cjs,mjs,js,ts,jsx,tsx}": async (files) => {
const filesToLint = await removeIgnoredFiles(files);

return [`prettier --config .prettierrc.json --ignore-path --write ${filesToLint}`];
return [`eslint -c .eslintrc.json --max-warnings=0 --fix ${filesToLint}`];
},
// TODO: fix linter rules
// "./packages/**/**/*.{js,cjs,mjs,ts,jsx,tsx}": async (files) => {
// const filesToLint = await removeIgnoredFiles(files);
"**/*.{css,json,md}": async (files) => {
const filesToLint = await removeIgnoredFiles(files);

// return [`eslint -c .eslintrc.json --max-warnings=0 --fix ${filesToLint}`];
// },
return [`prettier --config .prettierrc.json --ignore-path --write ${filesToLint}`];
},
};
58 changes: 27 additions & 31 deletions apps/docs/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,31 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"parserOptions": {
"project": ["apps/docs/tsconfig(.*)?.json"],
"ecmaFeatures": {
"jsx": true
}
},
"rules": {
"react/no-unknown-property": [
2,
{
"ignore": [
"jsx",
"global"
]
}
]
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"parserOptions": {
"project": ["apps/docs/tsconfig(.*)?.json"],
"ecmaFeatures": {
"jsx": true
}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
"rules": {
"react/no-unknown-property": [
2,
{
"ignore": ["jsx", "global"]
}
]
}
]
}

},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
"eslint-plugin-promise": "^6.0.0",
"eslint-plugin-react": "^7.23.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-unused-imports": "^2.0.0",
"execa": "^5.1.1",
"find-up": "^6.3.0",
"fs-extra": "^10.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/components/avatar/src/avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import {forwardRef} from "@nextui-org/system";
import {__DEV__} from "@nextui-org/shared-utils";
import {useMemo} from "react";

import {useAvatar, UseAvatarProps} from "./use-avatar";
import {AvatarIcon} from "./avatar-icon";
import {useAvatar, UseAvatarProps} from "./use-avatar";

export interface AvatarProps extends UseAvatarProps {}

Expand Down
2 changes: 1 addition & 1 deletion packages/components/checkbox/__tests__/checkbox.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from "react";
import {render} from "@testing-library/react";
import userEvent from "@testing-library/user-event";

import {Checkbox, CheckboxProps} from "../src";
import {Checkbox} from "../src";

describe("Checkbox", () => {
it("should render correctly", () => {
Expand Down
61 changes: 47 additions & 14 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit de1556e

Please sign in to comment.