3.4.1 • Published 9 months ago
@vervocity/eslint-config v3.4.1
Vervocity JS Coding Standard
Installation
!NOTE
All eslint configurations are setup to be used with prettier.
npm install --save-dev @vervocity/eslint-configCreate eslint.config.mjs file.
import { eslint } from '@vervocity/eslint-config'
export default eslint.standardCreate prettier.config.mjs
import { prettier } from '@vervocity/eslint-config'
export default prettier.standardCreate a .prettierignore to ignore files from prettier.
*.mdUsage
npx prettier resources/js --checknpx eslint "resources/js/**/*.{js,ts,vue}"If desired, add the following to your package.json. Make sure to update the resources path to the correct location.
"scripts" {
"lint": "npx eslint resources",
"lint:fix": "npm run lint -- --fix",
"prettier": "npx prettier resources",
"prettier:fix": "npm run prettier -- --write",
"format": "npm run prettier:fix && npm run lint:fix",
}Then run the following to format your entire codebase.
npm run formatVS Code
Extensions
Settings.json
{
// Disable since we will be using `editor.codeActionsOnSave` instead
"editor.formatOnSave": false,
"eslint.format.enable": false,
// Set the default formatter to prettier
"editor.defaultFormatter": "esbenp.prettier-vscode",
// Runs Prettier, then ESLint
"editor.codeActionsOnSave": [
// `source.formatDocument` will first run the defaultFormatter
"source.formatDocument",
// Then run eslint after prettier
"source.fixAll.eslint"
]
}