Skip to content

Commit

Permalink
Add eslint config for nextjs application
Browse files Browse the repository at this point in the history
  • Loading branch information
marshallku committed Feb 4, 2024
1 parent 3c7bc4c commit 21fdca3
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 44 deletions.
9 changes: 9 additions & 0 deletions apps/blog/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/** @type {import("eslint").Linter.Config} */
module.exports = {
root: true,
extends: ["@marshallku/eslint-config/next.js"],
parser: "@typescript-eslint/parser",
parserOptions: {
project: true,
},
};
2 changes: 2 additions & 0 deletions apps/blog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"@marshallku/toast": "workspace:^",
"@marshallku/ui": "workspace:^",
"@marshallku/utils": "workspace:^",
"@next/eslint-plugin-next": "^14.1.0",
"copy2clip": "^1.1.1",
"gray-matter": "^4.0.3",
"image-size": "^1.1.1",
Expand All @@ -37,6 +38,7 @@
"@types/node": "^20.11.5",
"@types/react": "^18.2.48",
"@types/react-dom": "^18.2.18",
"eslint": "^8.56.0",
"sass": "^1.70.0",
"typescript": "^5.3.3"
}
Expand Down
35 changes: 35 additions & 0 deletions packages/eslint-config/next.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
const { resolve } = require("node:path");

const project = resolve(process.cwd(), "tsconfig.json");

/** @type {import("eslint").Linter.Config} */
module.exports = {
extends: [
"eslint:recommended",
"prettier",
require.resolve("@vercel/style-guide/eslint/next"),
"eslint-config-turbo",
],
globals: {
React: true,
JSX: true,
},
env: {
node: true,
browser: true,
},
plugins: ["only-warn"],
settings: {
"import/resolver": {
typescript: {
project,
},
},
},
ignorePatterns: [
// Ignore dotfiles
".*.js",
"node_modules/",
],
overrides: [{ files: ["*.js?(x)", "*.ts?(x)"] }],
};
4 changes: 3 additions & 1 deletion packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
"files": [
"library.js",
"react.js",
"storybook.js"
"storybook.js",
"next.js"
],
"devDependencies": {
"@next/eslint-plugin-next": "^14.1.0",
"@vercel/style-guide": "^5.1.0",
"eslint-config-turbo": "^1.11.3",
"eslint-plugin-mdx": "^2.3.2",
Expand Down
Loading

0 comments on commit 21fdca3

Please sign in to comment.