Skip to content

Commit

Permalink
(chore) Separate linting and formatting concerns (#51)
Browse files Browse the repository at this point in the history
* (chore) Separate linting and formatting concerns

* (chore) Fix Prettier glob patterns
  • Loading branch information
denniskigen authored Apr 9, 2024
1 parent 79b5fc4 commit e4d65a9
Show file tree
Hide file tree
Showing 6 changed files with 508 additions and 456 deletions.
32 changes: 28 additions & 4 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,14 +1,37 @@
{
"env": {
"node": true
},
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint"
],
"extends": ["ts-react-important-stuff", "plugin:prettier/recommended"],
"plugins": ["@typescript-eslint", "react-hooks"],
"rules": {
// Disabling these rules for now just to keep the diff small. I'll enable them one by one as we go.
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/triple-slash-reference": "off",
// Use `import type` instead of `import` for type imports https://typescript-eslint.io/blog/consistent-type-imports-and-exports-why-and-how
"@typescript-eslint/consistent-type-imports": [
"error",
{
"fixStyle": "inline-type-imports"
}
],
"prefer-const": "off",
"no-console": ["error", { "allow": ["warn", "error"] }],
"no-unsafe-optional-chaining": "off",
"no-explicit-any": "off",
"no-extra-boolean-cast": "off",
"no-prototype-builtins": "off",
"no-useless-escape": "off",
"no-restricted-imports": [
"error",
{
"paths": [
// These two rules ensure that we're importing lodash and lodash-es correctly. Not doing so can bloat our bundle size significantly.
{
"name": "lodash",
"message": "Import specific methods from `lodash`. e.g. `import map from 'lodash/map'`"
Expand All @@ -18,6 +41,7 @@
"importNames": ["default"],
"message": "Import specific methods from `lodash-es`. e.g. `import { map } from 'lodash-es'`"
},
// These two rules ensure that we're importing Carbon components and icons from the correct packages (after v10). May be removed in the future.
{
"name": "carbon-components-react",
"message": "Import from `@carbon/react` directly. e.g. `import { Toggle } from '@carbon/react'`"
Expand Down
4 changes: 2 additions & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@

set -e # die on error

yarn prettier
yarn run extract-translations
npx lint-staged
yarn run extract-translations
324 changes: 162 additions & 162 deletions .yarn/releases/yarn-4.1.0.cjs → .yarn/releases/yarn-4.1.1.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ enableGlobalCache: false

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.1.0.cjs
yarnPath: .yarn/releases/yarn-4.1.1.cjs
14 changes: 8 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
"start-all": "openmrs develop --sources 'packages/esm-*-app/'",
"ci:publish": "yarn workspaces foreach --all --topological --exclude @openmrs/esm-admin-tools npm publish --access public --tag latest",
"ci:prepublish": "yarn workspaces foreach --all --topological --exclude @openmrs/esm-admin-tools npm publish --access public --tag next",
"lint": "cross-env eslint src --ext tsx,ts --fix --max-warnings=0",
"release": "yarn workspaces foreach --all --topological version",
"verify": "turbo lint typescript test",
"prettier": "prettier --config prettier.config.js --write \"packages/**/*.{ts,tsx}\" \"e2e/**/*.ts\" --list-different",
"postinstall": "husky install",
"test-e2e": "playwright test",
"coverage": "yarn test --coverage",
Expand Down Expand Up @@ -41,19 +41,17 @@
"dayjs": "^1.11.10",
"dotenv": "^16.4.5",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-ts-react-important-stuff": "^3.0.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react-hooks": "^4.6.0",
"husky": "^9.0.11",
"i18next": "^23.10.0",
"i18next-parser": "^8.13.0",
"identity-obj-proxy": "^3.0.0",
"jest": "^29.7.0",
"jest-cli": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"lint-staged": "^15.2.2",
"openmrs": "next",
"prettier": "^3.2.5",
"pretty-quick": "^4.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-i18next": "^14.0.5",
Expand All @@ -66,5 +64,9 @@
"webpack": "^5.90.3",
"webpack-cli": "^5.1.4"
},
"packageManager": "[email protected]"
"lint-staged": {
"*.{ts,tsx}": "eslint --cache --fix --max-warnings 0",
"*.{css,scss,ts,tsx}": "prettier --write --list-different"
},
"packageManager": "[email protected]"
}
Loading

0 comments on commit e4d65a9

Please sign in to comment.