Skip to content

Commit

Permalink
turbo eslint for packages (srcbookdev#248)
Browse files Browse the repository at this point in the history
  • Loading branch information
versecafe authored Sep 3, 2024
1 parent 00be017 commit 35a5e25
Show file tree
Hide file tree
Showing 12 changed files with 129 additions and 2 deletions.
13 changes: 13 additions & 0 deletions packages/api/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/** @type {import("eslint").Linter.Config} */
module.exports = {
root: true,
extends: [require.resolve('@srcbook/configs/eslint/library.js')],
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.lint.json',
tsconfigRootDir: __dirname,
},
globals: {
Bun: false,
},
};
1 change: 1 addition & 0 deletions packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"test": "vitest",
"prebuild": "rm -rf ./dist",
"build": "tsc && cp -R ./drizzle ./dist/drizzle && cp -R ./srcbook/examples ./dist/srcbook/examples && cp -R ./prompts ./dist/prompts",
"lint": "eslint . --max-warnings 0",
"check-types": "tsc",
"depcheck": "depcheck",
"generate": "drizzle-kit generate",
Expand Down
4 changes: 4 additions & 0 deletions packages/api/tsconfig.lint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"include": ["**/*.mts", "vite.config.ts", "drizzle.config.ts"],
"exclude": ["node_modules", "dist"]
}
33 changes: 33 additions & 0 deletions packages/configs/eslint/library.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const { resolve } = require('node:path');

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

/** @type {import("eslint").Linter.Config} */
module.exports = {
extends: ['prettier', 'turbo'],
globals: {
React: true,
JSX: true,
},
env: {
node: true,
},
settings: {
'import/resolver': {
typescript: {
project,
},
},
},
ignorePatterns: [
// Ignore dotfiles
'.*.js',
'node_modules/',
'dist/',
],
overrides: [
{
files: ['*.js?(x)', '*.ts?(x)'],
},
],
};
9 changes: 8 additions & 1 deletion packages/configs/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
{
"name": "@srcbook/configs",
"version": "0.0.0",
"private": true
"private": true,
"files": [
"./eslint/library.js"
],
"devDependencies": {
"eslint-config-turbo": "^2.1.1",
"eslint-config-prettier": "^9.1.0"
}
}
13 changes: 13 additions & 0 deletions packages/shared/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/** @type {import("eslint").Linter.Config} */
module.exports = {
root: true,
extends: [require.resolve('@srcbook/configs/eslint/library.js')],
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.lint.json',
tsconfigRootDir: __dirname,
},
globals: {
Bun: false,
},
};
1 change: 1 addition & 0 deletions packages/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"prebuild": "rm -rf ./dist",
"build": "tsc",
"dev": "tsc --watch --project .",
"lint": "eslint . --max-warnings 0",
"check-types": "tsc",
"prepublishOnly": "npm run build"
},
Expand Down
4 changes: 4 additions & 0 deletions packages/shared/tsconfig.lint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"include": ["src", "index.ts", "tests"],
"exclude": ["node_modules", "dist"]
}
35 changes: 34 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions srcbook/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/** @type {import("eslint").Linter.Config} */
module.exports = {
root: true,
extends: [require.resolve('@srcbook/configs/eslint/library.js')],
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.lint.json',
tsconfigRootDir: __dirname,
},
globals: {
Bun: false,
},
};
1 change: 1 addition & 0 deletions srcbook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"depcheck": "depcheck",
"prebuild": "rm -rf ./dist",
"build": "tsc",
"lint": "eslint . --max-warnings 0",
"prepublishOnly": "pnpm run --workspace-root build",
"preversion": "pnpm run build",
"postversion": "git push && git push --tags"
Expand Down
4 changes: 4 additions & 0 deletions srcbook/tsconfig.lint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"include": ["src", "bin", "tests", "public"],
"exclude": ["node_modules", "dist"]
}

0 comments on commit 35a5e25

Please sign in to comment.