Skip to content

Commit

Permalink
🚧 prevent baseline errors from polluting vscode
Browse files Browse the repository at this point in the history
  • Loading branch information
victorlin committed Nov 4, 2024
1 parent 9221dc5 commit 8bb453a
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 46 deletions.
61 changes: 61 additions & 0 deletions .tsconfig-base.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
Much of Auspice was written in JavaScript. There is an effort to convert
existing JavaScript files to TypeScript in an iterative, file-by-file approach.
TypeScript is used in this project for type-checking only, not for its compiled
output files - Babel is used for that. Config options should reflect this usage
pattern.
You may notice that this config file is not saved as the commonly expected
.tsconfig.json. That is because we have a baseline set of exceptions for this
project which is not provided by the built-in TypeScript compiler, but instead a
third-party tool called tsc-baseline. Unfortunately, most (all?) code editors
will simply utilize .tsconfig.json without taking into account
.tsc-baseline.json, which results in baseline errors being reported in code
editors. The .tsconfig.json file serves as a workaround to suppress baseline
errors in code editors.
Visit https://aka.ms/tsconfig.json for a detailed list of options.
*/

{
"compilerOptions": {
/* Language and Environment */
"jsx": "react", /* Specify what JSX code is generated. */
"target": "es2015",

/* Modules */
"moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
"types": ["node", "webpack-env"], /* Specify type package names to be included without being referenced in a source file. */

/* JavaScript Support */
"allowJs": true, /* Allow JavaScript files to be a part of your program. This allows TS files to import from JS files. */

/* Emit */
"noEmit": true, /* Do not emit compiler output files like JavaScript source code, source-maps or declarations. */

/* Interop Constraints */
"isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
"allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */

/* Type Checking */
"strict": true, /* Enable all strict type-checking options. */
"noImplicitAny": false, /* Allow implicit any to make incremental TypeScript adoption easier. */
"noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
"noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
"noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
"noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
"noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
"noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
"allowUnusedLabels": false, /* Enable error reporting for unused labels. */
"allowUnreachableCode": false, /* Enable error reporting for unreachable code. */

/* Completeness */
"skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true, /* Skip type checking all .d.ts files. */
},
"include": [
"src/**/*"
]
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
"prepare": "npm run build",
"lint": "eslint --max-warnings=0 .",
"lint:fix": "eslint --fix .",
"type-check": "tsc | tsc-baseline check",
"type-check:update-baseline": "tsc | tsc-baseline save",
"type-check": "tsc --project .tsconfig-base.jsonc | tsc-baseline check",
"type-check:update-baseline": "tsc --project .tsconfig-base.jsonc | tsc-baseline save",
"get-data": "env bash ./scripts/get-data.sh",
"heroku-postbuild": "npm run build && npm run get-data",
"gzip-and-upload": "env bash ./scripts/gzip-and-upload.sh",
Expand Down
55 changes: 11 additions & 44 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,52 +1,19 @@
/*
Much of Auspice was written in JavaScript. There is an effort to convert
existing JavaScript files to TypeScript in an iterative, file-by-file approach.
The purpose of this file is to suppress baseline errors in code editors that do
not support tsc-baseline and simply look for a .tsconfig.json file to check for
TypeScript problems. Note that these rule suppressions are project-wide (which
is why we are using a baseline in the first place), so it will also suppress new
violations which would be caught by the baseline checker.
TypeScript is used in this project for type-checking only, not for its compiled
output files - Babel is used for that. Config options should reflect this usage
pattern.
Please run `npm run type-check` to properly check for TypeScript errors in this
project.
Visit https://aka.ms/tsconfig.json for a detailed list of options.
See .tsconfig-base.jsonc for more information.
*/

{
"extends": "./.tsconfig-base.jsonc",
"compilerOptions": {
/* Language and Environment */
"jsx": "react", /* Specify what JSX code is generated. */
"target": "es2015",

/* Modules */
"moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
"types": ["node", "webpack-env"], /* Specify type package names to be included without being referenced in a source file. */

/* JavaScript Support */
"allowJs": true, /* Allow JavaScript files to be a part of your program. This allows TS files to import from JS files. */

/* Emit */
"noEmit": true, /* Do not emit compiler output files like JavaScript source code, source-maps or declarations. */

/* Interop Constraints */
"isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
"allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */

/* Type Checking */
"strict": true, /* Enable all strict type-checking options. */
"noImplicitAny": false, /* Allow implicit any to make incremental TypeScript adoption easier. */
"noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
"noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
"noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
"noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
"noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
"noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
"allowUnusedLabels": false, /* Enable error reporting for unused labels. */
"allowUnreachableCode": false, /* Enable error reporting for unreachable code. */

/* Completeness */
"skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true, /* Skip type checking all .d.ts files. */
},
"include": [
"src/**/*"
]
"strictNullChecks": false
}
}

0 comments on commit 8bb453a

Please sign in to comment.