23 lines
515 B
JavaScript
23 lines
515 B
JavaScript
import path from "path";
|
|
|
|
const buildLintCommand = (filenames) => {
|
|
const isNext =
|
|
process.env.npm_package_devDependencies_next ||
|
|
process.env.npm_package_dependencies_next;
|
|
|
|
if (isNext) {
|
|
return `next lint --fix --file ${filenames
|
|
.map((f) => path.relative(process.cwd(), f))
|
|
.join(" --file ")}`;
|
|
}
|
|
|
|
return "eslint --fix";
|
|
};
|
|
|
|
const config = {
|
|
"*.{js,jsx,ts,tsx}": [buildLintCommand, "prettier --write"],
|
|
"*.{json,md,css,scss}": ["prettier --write"],
|
|
};
|
|
|
|
export default config;
|