pnpm install --save-dev @gearbox-solutions/eslint-config-gbx
touch .eslintrc.cjs
Add the following to your .eslintrc.cjs
module.exports = {
extends: '@gearbox-solutions/gbx',
};
export default {
plugins: [import('prettier-plugin-tailwindcss')],
printWidth: 120
}
Add the following two script to your package.json file.
You'll need to replace <src>
with the location of the files you'd like ESLint to target. This may be different for each project.
"scripts": {
"lint": "eslint --ext .ts,.js,.vue <src>",
"lint:fix": "eslint --ext .ts,.js,.vue <src> --fix",
"prettier:write": "prettier --write \"resources/js/**/*.{js,ts,vue}\""
},
Will display any errors or warnings ESLint finds in the codebase
npm run lint
Will attempt to fix any errors or warnings that ESLint finds
npm run lint:fix
Format files with Prettier formatting
npm run prettier:write
If you make changes to this package, you'll need to publish it to NPM. To do so, follow these steps:
- Update Version in
package.json
- Commit and push changes
- run
npm publish --access public