feat(ui): enforce absolute import paths

- add & configure `eslint-plug-path`
This commit is contained in:
psychedelicious 2023-11-27 16:10:20 +11:00
parent 3d4874dc34
commit 578c8ce5dd
3 changed files with 16 additions and 1 deletions

View File

@ -25,9 +25,11 @@ module.exports = {
'@typescript-eslint',
'eslint-plugin-react-hooks',
'i18next',
'path',
],
root: true,
rules: {
'path/no-relative-imports': ['error', { maxDepth: 0 }],
curly: 'error',
'i18next/no-literal-string': 2,
'react/jsx-no-bind': ['error', { allowBind: true }],

View File

@ -29,7 +29,7 @@
"lint:prettier": "prettier --check .",
"lint:tsc": "tsc --noEmit",
"lint": "concurrently -g -n eslint,prettier,tsc,madge -c cyan,green,magenta,yellow \"yarn run lint:eslint\" \"yarn run lint:prettier\" \"yarn run lint:tsc\" \"yarn run lint:madge\"",
"fix": "eslint --fix . && prettier --loglevel warn --write .",
"fix": "eslint --fix . && prettier --log-level warn --write .",
"lint-staged": "lint-staged",
"postinstall": "patch-package && yarn run theme",
"theme": "chakra-cli tokens src/theme/theme.ts",
@ -132,6 +132,7 @@
"eslint": "^8.53.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-i18next": "^6.0.3",
"eslint-plugin-path": "^1.2.2",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"husky": "^8.0.3",

View File

@ -3525,6 +3525,13 @@ eslint-plugin-i18next@^6.0.3:
lodash "^4.17.21"
requireindex "~1.1.0"
eslint-plugin-path@^1.2.2:
version "1.2.2"
resolved "https://registry.yarnpkg.com/eslint-plugin-path/-/eslint-plugin-path-1.2.2.tgz#5306f46036907ffe1abca6f6e21dc2c2bf869ad5"
integrity sha512-RJ5e/DXRUj7cFD6y3xX5r2syU0uKEkjo9sU8lpayxV/H2plNKPjWv/oRSrWv+XibWV1Qvsu7VELobBFFSPb1UQ==
dependencies:
load-tsconfig "^0.2.5"
eslint-plugin-react-hooks@^4.6.0:
version "4.6.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.6.0.tgz#4c3e697ad95b77e93f8646aaa1630c1ba607edd3"
@ -4662,6 +4669,11 @@ listr2@7.0.2:
rfdc "^1.3.0"
wrap-ansi "^8.1.0"
load-tsconfig@^0.2.5:
version "0.2.5"
resolved "https://registry.yarnpkg.com/load-tsconfig/-/load-tsconfig-0.2.5.tgz#453b8cd8961bfb912dea77eb6c168fe8cca3d3a1"
integrity sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg==
locate-path@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286"