Skip to content

Commit

Permalink
Lint staged files
Browse files Browse the repository at this point in the history
  • Loading branch information
hursey013 committed Apr 2, 2024
1 parent 0547d30 commit 9ceacad
Show file tree
Hide file tree
Showing 7 changed files with 762 additions and 12 deletions.
4 changes: 3 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"extends": ["eslint:recommended", "next/core-web-vitals", "prettier"],
"plugins": ["prettier"],
"rules": {
"no-unused-vars": 2,
"prefer-const": 2
"prefer-const": 2,
"prettier/prettier": "error"
}
}
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
10 changes: 10 additions & 0 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const path = require('path');

const buildEslintCommand = (filenames) =>
`next lint --fix --file ${filenames
.map((f) => path.relative(process.cwd(), f))
.join(' --file ')}`;

module.exports = {
'*.{js,jsx,ts,tsx}': [buildEslintCommand],
};
2 changes: 1 addition & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"semi": true,
"trailingComma": "es5",
"singleQuote": true,
"tabWidth": 4
"tabWidth": 2
}
13 changes: 4 additions & 9 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
const path = require("path");
const path = require('path');

module.exports = {
eslint: {
// directories that eslint will run on
// you can also list files (must give the file extension)
dirs: ['api', 'app', 'pages', '__tests__', 'middleware.js']
},
generateBuildId: async () => {
// placeholder build id for development
return "0.0.1";
return '0.0.1';
},
sassOptions: {
includePaths: [
path.join(__dirname, "node_modules", "@uswds", "uswds", "packages"),
path.join(__dirname, 'node_modules', '@uswds', 'uswds', 'packages'),
],
},
}
};
Loading

0 comments on commit 9ceacad

Please sign in to comment.