Skip to content

Commit

Permalink
update eslint config to include prettier (#3937)
Browse files Browse the repository at this point in the history
* update eslint config

* run prettier from eslint

* remove prettier in precommit hook
  • Loading branch information
zxbodya authored Nov 3, 2023
1 parent 31cc1ac commit 2f8a2fd
Show file tree
Hide file tree
Showing 34 changed files with 103 additions and 56 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
packages/*/lib
packages/*/dist
packages/docs/build
8 changes: 7 additions & 1 deletion .eslintrc-typescript → .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:react/jsx-runtime"
"plugin:react/jsx-runtime",
"plugin:prettier/recommended"
],
"rules": {
"react/no-deprecated": "warn",
Expand Down Expand Up @@ -60,5 +61,10 @@
"es6": true,
"browser": true,
"node": true
},
"settings": {
"react": {
"version": "detect"
}
}
}
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ jobs:
- run: npm i -g npm@9
- run: npm ci
- run: npm run lint
- run: npm run cs-check

- name: Build with Netlify badge
if: github.ref != 'refs/heads/main' && matrix.node-version != '14.x'
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ jobs:
NODE_OPTIONS: --max_old_space_size=4096
- run: npm test
- run: npm run lint
- run: npm run cs-check
- run: echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand Down
53 changes: 53 additions & 0 deletions package-lock.json

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

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"changed": "lerna changed",
"test": "lerna run --concurrency 2 --stream test",
"test:update": "lerna run --concurrency 2 --stream test:update",
"lint": "lerna run lint",
"lint": "eslint './packages/**/*.{ts,js,tsx,jsx}' --quiet",
"cs-check": "lerna run cs-check",
"cs-format": "lerna run cs-format",
"build": "lerna run --stream build",
Expand Down Expand Up @@ -42,8 +42,10 @@
"@typescript-eslint/parser": "^5.62.0",
"cross-env": "^7.0.3",
"eslint": "^8.48.0",
"eslint-config-prettier": "^8.10.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"husky": "^8.0.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/antd/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"extends": "../../.eslintrc-typescript",
"extends": "../../.eslintrc",
"plugins": ["@typescript-eslint", "jsx-a11y", "react", "import"]
}
3 changes: 1 addition & 2 deletions packages/antd/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
},
"lint-staged": {
"{src,test}/**/*.ts?(x)": [
"eslint --fix",
"prettier --write"
"eslint --fix"
]
},
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/bootstrap-4/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"extends": ["../../.eslintrc-typescript"],
"extends": ["../../.eslintrc"],
"plugins": ["@typescript-eslint", "jsx-a11y", "react", "import"]
}
3 changes: 1 addition & 2 deletions packages/bootstrap-4/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
},
"lint-staged": {
"{src,test}/**/*.ts?(x)": [
"eslint --fix",
"prettier --write"
"eslint --fix"
]
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/chakra-ui/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": ["../../.eslintrc-typescript"],
"extends": ["../../.eslintrc"],
"plugins": ["@typescript-eslint", "jsx-a11y", "react", "import", "@emotion"],
"rules": { "@emotion/jsx-import": "error" }
}
1 change: 0 additions & 1 deletion packages/chakra-ui/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

const defaultConfig = require('../../babel.config');

module.exports = defaultConfig;
3 changes: 1 addition & 2 deletions packages/chakra-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
},
"lint-staged": {
"{src,test}/**/*.ts?(x)": [
"eslint --fix",
"prettier --write"
"eslint --fix"
]
},
"engineStrict": false,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"extends": ["../../.eslintrc-typescript"],
"extends": ["../../.eslintrc"],
"plugins": ["@typescript-eslint", "jsx-a11y", "react", "import"]
}
3 changes: 1 addition & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
},
"lint-staged": {
"{src,test,testSnap}/**/*.[jt]s?(x)": [
"eslint --fix",
"prettier --write"
"eslint --fix"
]
},
"main": "dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const config = {
editUrl: 'https://github.com/rjsf-team/react-jsonschema-form/tree/main/packages/docs/',
lastVersion: 'current',
versions: {
'current': {
current: {
label: 'v5',
path: '',
},
Expand Down
4 changes: 1 addition & 3 deletions packages/docs/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
const sidebars = {
// By default, Docusaurus generates a sidebar from the docs folder structure
docs: [
{type: "autogenerated", dirName: '.'},
],
docs: [{ type: 'autogenerated', dirName: '.' }],
};

module.exports = sidebars;
2 changes: 1 addition & 1 deletion packages/fluent-ui/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"extends": ["../../.eslintrc-typescript"],
"extends": ["../../.eslintrc"],
"plugins": ["@typescript-eslint", "jsx-a11y", "react", "import"]
}
3 changes: 1 addition & 2 deletions packages/fluent-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
},
"lint-staged": {
"{src,test}/**/*.ts?(x)": [
"eslint --fix",
"prettier --write"
"eslint --fix"
]
},
"engineStrict": false,
Expand Down
2 changes: 1 addition & 1 deletion packages/material-ui/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"extends": ["../../.eslintrc-typescript"],
"extends": ["../../.eslintrc"],
"plugins": ["@typescript-eslint", "jsx-a11y", "react", "import"]
}
3 changes: 1 addition & 2 deletions packages/material-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
},
"lint-staged": {
"{src,test}/**/*.ts?(x)": [
"eslint --fix",
"prettier --write"
"eslint --fix"
]
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion packages/mui/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"extends": ["../../.eslintrc-typescript"],
"extends": ["../../.eslintrc"],
"plugins": ["@typescript-eslint", "jsx-a11y", "react", "import"]
}
3 changes: 1 addition & 2 deletions packages/mui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
},
"lint-staged": {
"{src,test}/**/*.ts?(x)": [
"eslint --fix",
"prettier --write"
"eslint --fix"
]
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion packages/playground/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"extends": "../../.eslintrc-typescript",
"extends": "../../.eslintrc",
"plugins": ["@typescript-eslint", "jsx-a11y", "react", "import"]
}
3 changes: 1 addition & 2 deletions packages/playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
},
"lint-staged": {
"src/**/*.ts?(x)": [
"eslint --fix",
"prettier --write"
"eslint --fix"
]
},
"files": [
Expand Down
22 changes: 11 additions & 11 deletions packages/playground/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ export default defineConfig({
preserveSymlinks: true, // Fixes https://github.com/rjsf-team/react-jsonschema-form/issues/3228
alias: {
// mapping packages in monorepo to make vite use sources directly avoiding build step
"@rjsf/antd" : path.resolve(__dirname, '../antd/src'),
"@rjsf/bootstrap-4" : path.resolve(__dirname, '../bootstrap-4/src'),
"@rjsf/chakra-ui" : path.resolve(__dirname, '../chakra-ui/src'),
"@rjsf/core" : path.resolve(__dirname, '../core/src'),
"@rjsf/fluent-ui" : path.resolve(__dirname, '../fluent-ui/src'),
"@rjsf/material-ui" : path.resolve(__dirname, '../material-ui/src'),
"@rjsf/mui" : path.resolve(__dirname, '../mui/src'),
"@rjsf/semantic-ui" : path.resolve(__dirname, '../semantic-ui/src'),
"@rjsf/utils": path.resolve(__dirname, '../utils/src'),
"@rjsf/validator-ajv8" : path.resolve(__dirname, '../validator-ajv8/src'),
'@rjsf/antd': path.resolve(__dirname, '../antd/src'),
'@rjsf/bootstrap-4': path.resolve(__dirname, '../bootstrap-4/src'),
'@rjsf/chakra-ui': path.resolve(__dirname, '../chakra-ui/src'),
'@rjsf/core': path.resolve(__dirname, '../core/src'),
'@rjsf/fluent-ui': path.resolve(__dirname, '../fluent-ui/src'),
'@rjsf/material-ui': path.resolve(__dirname, '../material-ui/src'),
'@rjsf/mui': path.resolve(__dirname, '../mui/src'),
'@rjsf/semantic-ui': path.resolve(__dirname, '../semantic-ui/src'),
'@rjsf/utils': path.resolve(__dirname, '../utils/src'),
'@rjsf/validator-ajv8': path.resolve(__dirname, '../validator-ajv8/src'),
// validator-ajv6 can not be mapped directly to the sources, because that causes wrong ajv version resolution
// which looks related to: https://github.com/vitejs/vite/issues/12618
//
// the difference when mapping directly vs mapping to src folder - @vitejs/plugin-react can not be applied in the 2nd case
"@rjsf/validator-ajv6" : '@rjsf/validator-ajv6/src',
'@rjsf/validator-ajv6': '@rjsf/validator-ajv6/src',
},
},
});
2 changes: 1 addition & 1 deletion packages/semantic-ui/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"extends": "../../.eslintrc-typescript",
"extends": "../../.eslintrc",
"plugins": ["@typescript-eslint", "jsx-a11y", "react", "import"]
}
3 changes: 1 addition & 2 deletions packages/semantic-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
},
"lint-staged": {
"{src,test}/**/*.ts(x)": [
"eslint --fix",
"prettier --write"
"eslint --fix"
]
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"extends": ["../../.eslintrc-typescript"],
"extends": ["../../.eslintrc"],
"plugins": ["@typescript-eslint", "jsx-a11y", "react", "import"]
}
3 changes: 1 addition & 2 deletions packages/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
},
"lint-staged": {
"{src,test}/**/*.ts?(x)": [
"eslint --fix",
"prettier --write"
"eslint --fix"
]
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/validator-ajv6/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"extends": ["../../.eslintrc-typescript"],
"extends": ["../../.eslintrc"],
"plugins": ["@typescript-eslint", "jsx-a11y", "react", "import"]
}
3 changes: 1 addition & 2 deletions packages/validator-ajv6/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
},
"lint-staged": {
"{src,test}/**/*.ts?(x)": [
"eslint --fix",
"prettier --write"
"eslint --fix"
]
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/validator-ajv8/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"extends": ["../../.eslintrc-typescript"],
"extends": ["../../.eslintrc"],
"plugins": ["@typescript-eslint", "jsx-a11y", "react", "import"]
}
Loading

0 comments on commit 2f8a2fd

Please sign in to comment.