├── .eslintignore ├── .eslintrc ├── .github ├── FUNDING.yml └── workflows │ └── node.js.yml ├── .gitignore ├── Readme.md ├── docs └── unused-exports.md ├── jest.config.js ├── package.json ├── src ├── index.ts └── rules │ ├── index.ts │ └── unused-exports.ts ├── tests ├── fixtures │ ├── file.tsx │ ├── invalid │ │ └── test1.ts │ ├── tsconfig.eslint.json │ └── valid │ │ ├── comp │ │ ├── index.ts │ │ └── test1.ts │ │ └── test.ts ├── index.test.ts └── unused-exports.test.ts ├── tsconfig.build.json ├── tsconfig.json ├── tsconfig.test.json └── yarn.lock /.eslintignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["react-native-wcandillon"] 3 | } -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | custom: https://react-native.shop/buy-me-a-coffee 2 | -------------------------------------------------------------------------------- /.github/workflows/node.js.yml: -------------------------------------------------------------------------------- 1 | name: CI & CD 2 | on: [push] 3 | 4 | jobs: 5 | build: 6 | 7 | runs-on: ubuntu-latest 8 | 9 | strategy: 10 | matrix: 11 | node-version: [12.x] 12 | 13 | steps: 14 | - uses: actions/checkout@v1 15 | - name: Use Node.js ${{ matrix.node-version }} 16 | uses: actions/setup-node@v1 17 | with: 18 | node-version: ${{ matrix.node-version }} 19 | - name: GitHub Action for Yarn 20 | uses: Borales/actions-yarn@v2.3.0 21 | - name: yarn install, build, and test 22 | run: | 23 | yarn lint 24 | yarn tsc 25 | yarn test 26 | - name: Deploy 27 | if: github.ref == 'refs/heads/master' 28 | run: npx semantic-release 29 | env: 30 | CI: true 31 | NPM_TOKEN: ${{ secrets.NPM_TOKEN }} 32 | GH_TOKEN: ${{ secrets.GH_TOKEN }} 33 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # docz 9 | .docz 10 | 11 | # Runtime data 12 | pids 13 | *.pid 14 | *.seed 15 | *.pid.lock 16 | 17 | # Directory for instrumented libs generated by jscoverage/JSCover 18 | lib-cov 19 | 20 | # Coverage directory used by tools like istanbul 21 | coverage 22 | 23 | # nyc test coverage 24 | .nyc_output 25 | 26 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 27 | .grunt 28 | 29 | # Bower dependency directory (https://bower.io/) 30 | bower_components 31 | 32 | # node-waf configuration 33 | .lock-wscript 34 | 35 | # Compiled binary addons (https://nodejs.org/api/addons.html) 36 | build/Release 37 | 38 | # Dependency directories 39 | node_modules/ 40 | jspm_packages/ 41 | 42 | # TypeScript v1 declaration files 43 | typings/ 44 | 45 | # Optional npm cache directory 46 | .npm 47 | 48 | # Optional eslint cache 49 | .eslintcache 50 | 51 | # Optional REPL history 52 | .node_repl_history 53 | 54 | # Output of 'npm pack' 55 | *.tgz 56 | 57 | # Yarn Integrity file 58 | .yarn-integrity 59 | 60 | # dotenv environment variables file 61 | .env 62 | 63 | # next.js build output 64 | .next 65 | 66 | # build 67 | dist/ 68 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | # 🚨 Do Not Use it 🚨 2 | This plugin is not in a usable state at the moment. We are trying to figure out a way to maintain a clean dependency tree without using too much resources. 3 | 4 | ESLint wrapper for ts-prune 5 | 6 | ## Installation 7 | 8 | This plugin requires your project to use TypeScript (>=4.1.3). 9 | 10 | ```sh 11 | yarn add eslint-plugin-ts-exports --dev 12 | ``` 13 | 14 | ## Example Configuration 15 | 16 | The plugin relies on TypeScript compiler services to resolve types. 17 | You need to set your `tsconfig.json` file in your eslint configuration via `parserOptions`. 18 | 19 | ```json 20 | { 21 | "plugins": ["ts-exports"], 22 | "parserOptions": { 23 | "project": "./tsconfig.json" 24 | }, 25 | "rules": { 26 | "ts-exports/unused-exports": 2, 27 | } 28 | } 29 | ``` 30 | 31 | ## Rules 32 | * [unused-exports](./docs/unused-exports.md) 33 | -------------------------------------------------------------------------------- /docs/unused-exports.md: -------------------------------------------------------------------------------- 1 | # Unused Exports (`unused-exports`) 2 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // @ts-check 4 | /** @type {import('@jest/types').Config.InitialOptions} */ 5 | module.exports = { 6 | globals: { 7 | 'ts-jest': { 8 | isolatedModules: true, 9 | tsconfig: 'tsconfig.test.json', 10 | }, 11 | }, 12 | testEnvironment: 'node', 13 | transform: { 14 | '^.+\\.tsx?$': 'ts-jest', 15 | }, 16 | testRegex: './tests/.+\\.test\\.ts$', 17 | collectCoverage: false, 18 | collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}'], 19 | moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], 20 | coverageReporters: ['text-summary', 'lcov'], 21 | }; -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "eslint-plugin-ts-exports", 3 | "version": "0.0.0-development", 4 | "main": "dist/index.js", 5 | "license": "MIT", 6 | "scripts": { 7 | "prepublish": "yarn build", 8 | "test": "jest --coverage", 9 | "lint": "eslint --ext .ts,.tsx . --max-warnings 0", 10 | "tsc": "tsc", 11 | "build": "tsc -b tsconfig.build.json", 12 | "ci": "yarn lint && yarn tsc && yarn test", 13 | "semantic-release": "semantic-release" 14 | }, 15 | "files": [ 16 | "dist" 17 | ], 18 | "author": { 19 | "name": "William Candillon", 20 | "email": "wcandillon@gmail.com" 21 | }, 22 | "devDependencies": { 23 | "@types/node": "^14.14.20", 24 | "eslint": "^7.17.0", 25 | "eslint-config-react-native-wcandillon": "^3.3.6", 26 | "jest": "^26.6.3", 27 | "react-native-reanimated": "2.0.0-rc.1", 28 | "react-native-redash": "^16.0.6", 29 | "semantic-release": "^17.3.1", 30 | "ts-jest": "^26.4.4" 31 | }, 32 | "peerDependencies": { 33 | "eslint": ">=7.17.0", 34 | "typescript": ">=4.1.3" 35 | }, 36 | "dependencies": { 37 | "@typescript-eslint/experimental-utils": "^4.12.0", 38 | "ts-prune": "https://firebasestorage.googleapis.com/v0/b/start-react-native.appspot.com/o/ts-prune-v0.0.3-wcandillon.tgz?alt=media&token=f5c337f6-c8bb-41dd-a958-cb9c52e2f6d1", 39 | "typescript": "^4.1.3" 40 | }, 41 | "repository": { 42 | "type": "git", 43 | "url": "https://github.com/wcandillon/eslint-plugin-ts-exports.git" 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | import rules from "./rules"; 2 | 3 | export = { 4 | rules, 5 | }; 6 | -------------------------------------------------------------------------------- /src/rules/index.ts: -------------------------------------------------------------------------------- 1 | import unusedExports from "./unused-exports"; 2 | 3 | const rules = { 4 | "unused-exports": unusedExports, 5 | }; 6 | 7 | export default rules; 8 | -------------------------------------------------------------------------------- /src/rules/unused-exports.ts: -------------------------------------------------------------------------------- 1 | import path from "path"; 2 | 3 | import { ESLintUtils } from "@typescript-eslint/experimental-utils"; 4 | import { run } from "ts-prune/lib/runner"; 5 | 6 | export type Options = [ 7 | { 8 | ignoreUsedInModule?: boolean; 9 | ignoreTests?: boolean; 10 | ignoreIndex?: boolean; 11 | ignoreFiles?: string; 12 | } 13 | ]; 14 | export type MessageIds = "UnusedExportsMessage"; 15 | 16 | type ResultSymbol = { 17 | name: string; 18 | start: { 19 | line: number; 20 | column: number; 21 | }; 22 | end: { 23 | line: number; 24 | column: number; 25 | }; 26 | usedInModule: boolean; 27 | }; 28 | 29 | interface Analysis { 30 | [file: string]: ResultSymbol[]; 31 | } 32 | 33 | const createRule = ESLintUtils.RuleCreator((name) => { 34 | return `https://github.com/wcandillon/eslint-plugin-ts-exports/blob/master/docs/${name}.md`; 35 | }); 36 | 37 | const UnusedExportsMessage = "export {{name}} is unused"; 38 | const normalizePath = (filePath: string) => 39 | process.platform === "darwin" ? filePath.toLowerCase() : filePath; 40 | 41 | export default createRule({ 42 | name: "unused-exports", 43 | meta: { 44 | type: "problem", 45 | docs: { 46 | description: "Detects unused exports in TypeScript", 47 | category: "Possible Errors", 48 | recommended: "error", 49 | }, 50 | fixable: "code", 51 | schema: [ 52 | { 53 | type: "object", 54 | properties: { 55 | ignoreUsedInModule: { 56 | type: "boolean", 57 | }, 58 | ignoreTests: { 59 | type: "boolean", 60 | }, 61 | ignoreIndex: { 62 | type: "boolean", 63 | }, 64 | ignoreFiles: { 65 | type: "string", 66 | }, 67 | }, 68 | additionalProperties: false, 69 | }, 70 | ], 71 | messages: { 72 | UnusedExportsMessage, 73 | }, 74 | }, 75 | defaultOptions: [ 76 | { ignoreTests: false, ignoreIndex: true, ignoreUsedInModule: false }, 77 | ], 78 | create: (context) => { 79 | const { ignoreUsedInModule, ignoreTests, ignoreIndex, ignoreFiles } = { 80 | ignoreTests: false, 81 | ignoreIndex: true, 82 | ignoreUsedInModule: false, 83 | ...context.options[0], 84 | }; 85 | const parserServices = ESLintUtils.getParserServices(context); 86 | const config = parserServices.program.getCompilerOptions() 87 | .configFilePath as string; 88 | const analysis: Analysis = {}; 89 | run( 90 | { 91 | project: config.substring(process.cwd().length), 92 | format: false, 93 | }, 94 | (result: { file: string; symbol: ResultSymbol }) => { 95 | if (ignoreIndex && result.file.match("/index\\.(ts|tsx)$")) { 96 | return; 97 | } 98 | if (ignoreTests && result.file.match("(spec|test|Test)")) { 99 | return; 100 | } 101 | if (ignoreUsedInModule && result.symbol.usedInModule) { 102 | return; 103 | } 104 | if (ignoreFiles && result.file.match(ignoreFiles)) { 105 | return; 106 | } 107 | const nonNormalizedFile = path.join(process.cwd(), result.file); 108 | const file = normalizePath(nonNormalizedFile); 109 | if (analysis !== null && analysis[file] === undefined) { 110 | analysis[file] = [result.symbol]; 111 | } else if (analysis !== null) { 112 | (analysis[file] as ResultSymbol[]).push(result.symbol); 113 | } 114 | } 115 | ); 116 | return { 117 | Program: (node) => { 118 | const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node); 119 | const { fileName } = tsNode; 120 | if (!analysis) { 121 | return; 122 | } 123 | const errors = analysis[normalizePath(fileName)]; 124 | if (errors) { 125 | errors.forEach(({ name, start, end }) => { 126 | context.report({ 127 | messageId: "UnusedExportsMessage", 128 | loc: { 129 | start: { 130 | line: start.line, 131 | column: start.column - 1, 132 | }, 133 | end: { 134 | line: end.line, 135 | column: end.column - 1, 136 | }, 137 | }, 138 | data: { 139 | name, 140 | }, 141 | }); 142 | }); 143 | } 144 | }, 145 | }; 146 | }, 147 | }); 148 | -------------------------------------------------------------------------------- /tests/fixtures/file.tsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wcandillon/eslint-plugin-ts-exports/ed6eab4b41bd73ef7e879e8cde8427dd52c13a7e/tests/fixtures/file.tsx -------------------------------------------------------------------------------- /tests/fixtures/invalid/test1.ts: -------------------------------------------------------------------------------- 1 | export const foo = 1; 2 | export default foo; 3 | -------------------------------------------------------------------------------- /tests/fixtures/tsconfig.eslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | /* Visit https://aka.ms/tsconfig.json to read more about this file */ 4 | /* Basic Options */ 5 | // "incremental": true, /* Enable incremental compilation */ 6 | "target": "es2017", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */ 7 | "module": "system", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ 8 | "lib": ["es2017"], /* Specify library files to be included in the compilation. */ 9 | // "allowJs": true, /* Allow javascript files to be compiled. */ 10 | // "checkJs": true, /* Report errors in .js files. */ 11 | "jsx": "react-native", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ 12 | // "declaration": true, /* Generates corresponding '.d.ts' file. */ 13 | // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ 14 | // "sourceMap": true, /* Generates corresponding '.map' file. */ 15 | // "outFile": "./", /* Concatenate and emit output to single file. */ 16 | //"outFile": "./dist/index.js", /* Redirect output structure to the directory. */ 17 | "rootDir": ".", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ 18 | // "composite": true, /* Enable project compilation */ 19 | // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ 20 | // "removeComments": true, /* Do not emit comments to output. */ 21 | "noEmit": true, /* Do not emit outputs. */ 22 | // "importHelpers": true, /* Import emit helpers from 'tslib'. */ 23 | // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ 24 | // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ 25 | /* Strict Type-Checking Options */ 26 | "strict": true, /* Enable all strict type-checking options. */ 27 | "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ 28 | "strictNullChecks": true, /* Enable strict null checks. */ 29 | "strictFunctionTypes": true, /* Enable strict checking of function types. */ 30 | "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ 31 | "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ 32 | "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ 33 | "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ 34 | /* Additional Checks */ 35 | "noUnusedLocals": true, /* Report errors on unused locals. */ 36 | "noUnusedParameters": true, /* Report errors on unused parameters. */ 37 | "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ 38 | "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ 39 | "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ 40 | /* Module Resolution Options */ 41 | "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ 42 | // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ 43 | // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ 44 | // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ 45 | // "typeRoots": [], /* List of folders to include type definitions from. */ 46 | // "types": [], /* Type declaration files to be included in compilation. */ 47 | // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ 48 | "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ 49 | // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ 50 | // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ 51 | /* Source Map Options */ 52 | // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ 53 | // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ 54 | // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ 55 | // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ 56 | /* Experimental Options */ 57 | // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ 58 | // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ 59 | /* Advanced Options */ 60 | "skipLibCheck": true, /* Skip type checking of declaration files. */ 61 | "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ 62 | } 63 | } -------------------------------------------------------------------------------- /tests/fixtures/valid/comp/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from "./test1"; 2 | -------------------------------------------------------------------------------- /tests/fixtures/valid/comp/test1.ts: -------------------------------------------------------------------------------- 1 | const foo = 1; 2 | 3 | export default foo; 4 | -------------------------------------------------------------------------------- /tests/fixtures/valid/test.ts: -------------------------------------------------------------------------------- 1 | import foo from "./comp"; 2 | 3 | console.log({ foo }); 4 | -------------------------------------------------------------------------------- /tests/index.test.ts: -------------------------------------------------------------------------------- 1 | import rules from "../src/rules"; 2 | 3 | function camelToUnderscore(key: string) { 4 | const result = key.replace(/([A-Z])/g, " $1"); 5 | return result.split(" ").join("-").toLowerCase(); 6 | } 7 | 8 | describe('eslint-plugin ("./src/index.ts")', () => { 9 | const ruleKeys = Object.keys({ 10 | unusedExports: true, 11 | }).map((rule) => camelToUnderscore(rule)); 12 | const eslintPluginRuleKeys = Object.keys(rules); 13 | 14 | it("exports all available rules", () => { 15 | expect(ruleKeys).toEqual(expect.arrayContaining(eslintPluginRuleKeys)); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /tests/unused-exports.test.ts: -------------------------------------------------------------------------------- 1 | import path from "path"; 2 | import fs from "fs"; 3 | 4 | import { ESLintUtils } from "@typescript-eslint/experimental-utils"; 5 | 6 | import rule from "../src/rules/unused-exports"; 7 | 8 | const ruleTester = new ESLintUtils.RuleTester({ 9 | parser: "@typescript-eslint/parser", 10 | parserOptions: { 11 | project: "./tsconfig.eslint.json", 12 | tsconfigRootDir: path.join(__dirname, "fixtures"), 13 | sourceType: "module", 14 | ecmaFeatures: { 15 | jsx: true, 16 | }, 17 | }, 18 | }); 19 | 20 | const code = (name: string) => 21 | fs.readFileSync(path.join(__dirname, name), "utf8"); 22 | 23 | ruleTester.run("unused-exports", rule, { 24 | valid: [ 25 | { 26 | code: code("fixtures/valid/test.ts"), 27 | filename: "valid/test.ts", 28 | }, 29 | ], 30 | invalid: [ 31 | { 32 | code: code("fixtures/invalid/test1.ts"), 33 | filename: "invalid/test1.ts", 34 | errors: [ 35 | { 36 | messageId: "UnusedExportsMessage", 37 | data: { 38 | name: "foo", 39 | }, 40 | }, 41 | { 42 | messageId: "UnusedExportsMessage", 43 | data: { 44 | name: "default", 45 | }, 46 | }, 47 | ], 48 | }, 49 | ], 50 | }); 51 | -------------------------------------------------------------------------------- /tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "rootDir": "./src", 5 | "noEmit": false, 6 | }, 7 | "include": ["src"], 8 | } -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | /* Visit https://aka.ms/tsconfig.json to read more about this file */ 4 | /* Basic Options */ 5 | // "incremental": true, /* Enable incremental compilation */ 6 | "target": "es2017", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */ 7 | "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ 8 | "lib": ["es2017"], /* Specify library files to be included in the compilation. */ 9 | // "allowJs": true, /* Allow javascript files to be compiled. */ 10 | // "checkJs": true, /* Report errors in .js files. */ 11 | // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ 12 | "declaration": false, /* Generates corresponding '.d.ts' file. */ 13 | "declarationMap": false, /* Generates a sourcemap for each corresponding '.d.ts' file. */ 14 | "sourceMap": false, /* Generates corresponding '.map' file. */ 15 | // "outFile": "./", /* Concatenate and emit output to single file. */ 16 | "outDir": "./dist", /* Redirect output structure to the directory. */ 17 | //"rootDir": ".", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ 18 | // "composite": true, /* Enable project compilation */ 19 | // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ 20 | // "removeComments": true, /* Do not emit comments to output. */ 21 | "noEmit": true, /* Do not emit outputs. */ 22 | // "importHelpers": true, /* Import emit helpers from 'tslib'. */ 23 | // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ 24 | // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ 25 | /* Strict Type-Checking Options */ 26 | "strict": true, /* Enable all strict type-checking options. */ 27 | "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ 28 | "strictNullChecks": true, /* Enable strict null checks. */ 29 | "strictFunctionTypes": true, /* Enable strict checking of function types. */ 30 | "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ 31 | "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ 32 | "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ 33 | "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ 34 | /* Additional Checks */ 35 | "noUnusedLocals": true, /* Report errors on unused locals. */ 36 | "noUnusedParameters": true, /* Report errors on unused parameters. */ 37 | "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ 38 | "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ 39 | "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ 40 | /* Module Resolution Options */ 41 | "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ 42 | // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ 43 | // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ 44 | // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ 45 | // "typeRoots": [], /* List of folders to include type definitions from. */ 46 | // "types": [], /* Type declaration files to be included in compilation. */ 47 | "allowUnreachableCode": false, 48 | "allowUnusedLabels": false, 49 | "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ 50 | "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ 51 | // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ 52 | // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ 53 | /* Source Map Options */ 54 | // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ 55 | // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ 56 | // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ 57 | // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ 58 | /* Experimental Options */ 59 | // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ 60 | // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ 61 | /* Advanced Options */ 62 | "skipLibCheck": true, /* Skip type checking of declaration files. */ 63 | "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /tsconfig.test.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "rootDir": "./test" 5 | } 6 | } --------------------------------------------------------------------------------