Skip to content

Commit

Permalink
add asset linting
Browse files Browse the repository at this point in the history
  • Loading branch information
bloodearnest committed Jan 19, 2024
1 parent ebab563 commit bbe7701
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 3 deletions.
52 changes: 52 additions & 0 deletions assets/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -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,
},
};
5 changes: 5 additions & 0 deletions assets/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion assets/models.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
# Create your models here.
4 changes: 2 additions & 2 deletions assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -129,6 +130,7 @@ check: devenv
fix: devenv
$BIN/ruff format .
$BIN/ruff --fix .
{{ just_executable() }} assets/fix


# run Django's manage.py entrypoint
Expand Down

0 comments on commit bbe7701

Please sign in to comment.