Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add eslint #2

Merged
merged 9 commits into from
Apr 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
yarn.lock
node_modules/
public/vite
public/vite-dev
public/vite-test
13 changes: 13 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: ['plugin:vue/essential', 'airbnb-base', 'prettier'],
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
plugins: ['vue'],
rules: {},
};
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
/tmp/*
!/log/.keep
!/tmp/.keep
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Ignore pidfiles, but keep the directory.
/tmp/pids/*
Expand Down Expand Up @@ -48,3 +51,6 @@ node_modules
# Vite uses dotenv and suggests to ignore local-only env files. See
# https://vitejs.dev/guide/env-and-mode.html#env-files
*.local

# Ignore uncategorized files
.DS_Store
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
[ -n "$CI" ] && exit 0
. "$(dirname "$0")/_/husky.sh"

npm run lint-staged
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
yarn.lock
node_modules/
public/vite
public/vite-dev
public/vite-test
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"trailingComma": "all",
"singleQuote": true,
"printWidth": 100
}
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,13 @@ Order by the commit I did:

### Front-end

- [Vite] Removing importmaps and all frontend libraries and Use Vite instead ([PR](https://github.com/zakariaf/rails7-base-app/pull/1))
- [Vite](https://github.com/ElMassimo/vite_ruby) Removing importmaps and all frontend libraries and Use Vite instead ([PR](https://github.com/zakariaf/rails7-base-app/pull/1))
- Code quality and format ([PR](https://github.com/zakariaf/rails7-base-app/pull/2))
- [ESlint](https://eslint.org/)
- [Eslint airbnb](https://github.com/airbnb/javascript)
- [Prettier](https://prettier.io/)
- [Husky](https://typicode.github.io/husky/#/)
- [lint-staged](https://github.com/okonet/lint-staged)

## Running this app

Expand Down
20 changes: 20 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
{
"scripts": {
"lint": "eslint 'app/javascript/**/*.{js,vue}' --fix",
"format": "prettier ./**/*.{js,css,scss,md,vue,json} --write",
"prepare": "husky install",
"lint-staged": "lint-staged"
},
"devDependencies": {
"eslint": "^8.12.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-vue": "^8.5.0",
"husky": "^7.0.4",
"lint-staged": "^12.3.7",
"prettier": "^2.6.2",
"vite": "^2.8.6",
"vite-plugin-ruby": "^3.0.8"
},
"lint-staged": {
"*.{js,vue}": [
"eslint --fix"
],
"*.{js,css,scss,md,vue,json}": "prettier --write"
}
}
Loading