Skip to content

Commit

Permalink
(chore) Configure tooling for linting and formatting (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
denniskigen authored Apr 3, 2024
1 parent 06ba397 commit 1d2bf90
Show file tree
Hide file tree
Showing 5 changed files with 2,115 additions and 2,417 deletions.
52 changes: 44 additions & 8 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,21 +1,48 @@
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": true
"env": {
"node": true
},
"plugins": [
"@typescript-eslint"
],
"extends": [
"eslint:recommended",
"plugin:prettier/recommended",
"ts-react-important-stuff"
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": true,
"tsconfigRootDir": "__dirname"
},
"plugins": ["@typescript-eslint", "react-hooks"],
"rules": {
"react-hooks/exhaustive-deps": "warn",
// The following rules need `noImplicitAny` to be set to `true` in our tsconfig. They are too restrictive for now, but should be reconsidered in future
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/unbound-method": "off",
// Nitpicky. Prefer `interface T` over type T
"@typescript-eslint/consistent-type-definitions": "error",
"@typescript-eslint/consistent-type-exports": "error",
// Use `import type` instead of `import` for type imports
"@typescript-eslint/consistent-type-imports": [
"error",
{
"fixStyle": "inline-type-imports"
}
],
// Use Array<T> instead of T[] consistently
"@typescript-eslint/array-type": [
"error",
{
"default": "generic"
}
],
"no-console": ["error", { "allow": ["warn", "error"] }],
"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 @@ -24,6 +51,15 @@
"name": "lodash-es",
"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'`"
},
{
"name": "@carbon/icons-react",
"message": "Import from `@carbon/react/icons`. e.g. `import { ChevronUp } from '@carbon/react/icons'`"
}
]
}
Expand Down
672 changes: 336 additions & 336 deletions .yarn/releases/yarn-4.0.2.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.0.2.cjs
yarnPath: .yarn/releases/yarn-4.1.1.cjs
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
"packages/*"
],
"lint-staged": {
"*.{js,jsx,ts,tsx}": "eslint --cache --fix"
"*.{js,jsx,ts,tsx}": [
"eslint --cache --fix",
"prettier --cache --write --ignore-unknown --list-different"
]
},
"scripts": {
"ci:publish": "yarn workspaces foreach --all --topological --exclude @openmrs/esm-home npm publish --access public --tag latest",
"ci:prepublish": "yarn workspaces foreach --all --topological --exclude @openmrs/esm-home npm publish --access public --tag next",
"release": "yarn workspaces foreach --all --topological version",
"prettier": "prettier --config prettier.config.js --write \"packages/**/*.{ts,tsx}\" --list-different",
"postinstall": "husky install",
"start": "openmrs develop --sources 'packages/esm-*-app/'",
"verify": "turbo lint typescript test"
Expand All @@ -37,9 +39,7 @@
"cross-env": "^7.0.3",
"css-loader": "^6.8.1",
"eslint": "^8.49.0",
"eslint-config-prettier": "^9.0.0",
"eslint-config-ts-react-important-stuff": "^3.0.0",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-react-hooks": "^4.6.0",
"husky": "^8.0.3",
"i18next": "^23.5.1",
"i18next-parser": "^8.7.0",
Expand All @@ -62,5 +62,5 @@
"webpack": "^5.88.2",
"webpack-cli": "^5.1.4"
},
"packageManager": "yarn@4.0.2"
"packageManager": "yarn@4.1.1"
}
Loading

0 comments on commit 1d2bf90

Please sign in to comment.