diff --git a/assets/.eslintrc.cjs b/assets/.eslintrc.cjs new file mode 100644 index 00000000..bb1ac8d3 --- /dev/null +++ b/assets/.eslintrc.cjs @@ -0,0 +1,52 @@ +module.exports = { + root: true, + extends: ["airbnb", "airbnb/hooks", "prettier"], + plugins: ["prettier", "testing-library"], + rules: { + "prettier/prettier": "error", + "react/jsx-props-no-spreading": "off", + "react/jsx-sort-props": [ + "error", + { + ignoreCase: true, + reservedFirst: true, + }, + ], + "react/function-component-definition": [ + 2, + { + namedComponents: "function-declaration", + unnamedComponents: "arrow-function", + }, + ], + "react/react-in-jsx-scope": [0], + "import/order": [ + "error", + { + groups: [ + ["builtin", "external", "internal"], + "parent", + "sibling", + "index", + ], + "newlines-between": "never", + alphabetize: { + order: "asc", + caseInsensitive: true, + }, + }, + ], + "jsx-a11y/label-has-associated-control": [ + 2, + { + inputComponents: ["Field"], + }, + ], + }, + env: { + browser: true, + }, + parserOptions: { + ecmaVersion: 2020, + }, +}; diff --git a/assets/justfile b/assets/justfile index a3881612..2d264d8a 100644 --- a/assets/justfile +++ b/assets/justfile @@ -61,6 +61,11 @@ run: install npm run dev +lint: install + npm run lint + +fix: install + npm run lint:fix test: install npm run test:coverage diff --git a/assets/models.py b/assets/models.py index 6b202199..e69de29b 100644 --- a/assets/models.py +++ b/assets/models.py @@ -1 +0,0 @@ -# Create your models here. diff --git a/assets/package.json b/assets/package.json index 70190e34..41cbd402 100644 --- a/assets/package.json +++ b/assets/package.json @@ -5,8 +5,8 @@ "dev": "vite", "build": "vite build", "serve": "vite preview", - "lint": "eslint \"./assets/src/**/*.{js,jsx}\"", - "lint:fix": "eslint \"./assets/src/**/*.{js,jsx}\" --fix", + "lint": "eslint \"./src/**/*.{js,jsx}\"", + "lint:fix": "eslint \"./src/**/*.{js,jsx}\" --fix", "test": "npx vitest run", "test:watch": "npx vitest", "test:coverage": "npx vitest run --coverage", diff --git a/justfile b/justfile index 9e653f8b..69394337 100644 --- a/justfile +++ b/justfile @@ -116,6 +116,7 @@ check: devenv check "$BIN/ruff format --diff --quiet ." check "$BIN/ruff check --show-source ." check "docker run --rm -i ghcr.io/hadolint/hadolint:v2.12.0-alpine < Dockerfile" + check "{{ just_executable() }} assets/lint" if [[ $failed > 0 ]]; then echo -en "\e[1;31m" @@ -129,6 +130,7 @@ check: devenv fix: devenv $BIN/ruff format . $BIN/ruff --fix . + {{ just_executable() }} assets/fix # run Django's manage.py entrypoint