Skip to content

Commit

Permalink
feat: discover tsconfig (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
peterpeterparker authored Sep 27, 2024
1 parent 45f8c1f commit e7180df
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 45 deletions.
17 changes: 16 additions & 1 deletion index.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { join } = require("node:path");
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { existsSync } = require("node:fs");

const resolveProject = () => {
const eslintJson = join(process.cwd(), "tsconfig.eslint.json");

if (existsSync(eslintJson)) {
return eslintJson;
}

return join(process.cwd(), "tsconfig.json");
};

module.exports = {
root: true,
extends: [
Expand All @@ -10,7 +25,7 @@ module.exports = {
parserOptions: {
sourceType: "module",
ecmaVersion: 2020,
project: ["./tsconfig.eslint.json"],
project: [resolveProject()],
},
env: {
browser: true,
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dfinity/eslint-config-oisy-wallet",
"version": "0.0.2",
"version": "0.0.3",
"license": "Apache-2.0",
"description": "Shared ESLint configurations from the Oisy Wallet team",
"repository": {
Expand All @@ -15,8 +15,7 @@
"LICENSE",
"index.cjs",
"svelte.cjs",
"eslint-local-rules.cjs",
"tsconfig.eslint.json"
"eslint-local-rules.cjs"
],
"exports": {
".": {
Expand Down
39 changes: 0 additions & 39 deletions tsconfig.eslint.json

This file was deleted.

14 changes: 14 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"compilerOptions": {
"module": "esnext",
"target": "esnext",
"lib": ["esnext", "dom"],
"declaration": true,
"strict": true,
"esModuleInterop": true,
"moduleResolution": "node",
"outDir": "dist",
"resolveJsonModule": true,
"skipLibCheck": true
}
}

0 comments on commit e7180df

Please sign in to comment.