Standardized set of configuration files for TypeScript projects so we don't have to think about them. Heavily inspired by @epic-web/config.
These are a set of defaults and everything can be overridden as needed per project.
npm install @theahaco/ts-config
Create a tsconfig.json file in the project root and
extend this config file:
{
"extends": ["@theahaco/ts-config/typescript"],
"include": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"],
"compilerOptions": {
// override here
}
}Create a reset.d.ts file:
import "@theahaco/ts-config/reset.d.ts"The configuration above assumes you're using a bundler to create an application. If you're creating a library, you'll want the configuration to be more strict to be consumable in as many setups as possible. You can extend a different config instead:
extends: ["@theahaco/ts-config/typescript.lib"],Create a eslint.config.js file in the project root and
extend this config file:
import { config } from "@theahaco/ts-config/eslint"
/** @type {import("eslint").Linter.Config[]} */
export default [
...config,
// override here
]Add a line in package.json to point to this config file:
"prettier": "@theahaco/ts-config/prettier",You can add a .prettierignore file to your project root if needed.