diff --git a/.eslintrc.js b/.eslintrc.js index 609dafb34..83e8a79ad 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -16,7 +16,7 @@ const javascriptSettings = { const typescriptSettings = { files: ['*.ts', '*.mts'], parserOptions: { - project: './tsconfig.json' + project: './tsconfig.base.json' }, plugins: [ '@typescript-eslint' diff --git a/jsconfig.json b/jsconfig.json new file mode 100644 index 000000000..7f5b3fad9 --- /dev/null +++ b/jsconfig.json @@ -0,0 +1,14 @@ +{ + "extends": "./tsconfig.base", + "compilerOptions": { + "allowJs": true, + "checkJs": true, + "noImplicitAny": false, + "noImplicitThis": false + }, + "include": [ + "**/*.ts", + "index.js", + "lib/**/*.js" + ] +} diff --git a/lib/suggestSimilar.js b/lib/suggestSimilar.js index 9a4066c71..75a527700 100644 --- a/lib/suggestSimilar.js +++ b/lib/suggestSimilar.js @@ -1,3 +1,5 @@ +// @ts-check + const maxDistance = 3; function editDistance(a, b) { diff --git a/package.json b/package.json index 0d7168fc2..2bbd105d6 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "test": "jest && npm run test-typings", "test-esm": "node ./tests/esm-imports-test.mjs", "test-typings": "tsd", - "typescript-checkJS": "tsc --allowJS --checkJS index.js lib/*.js --noEmit", + "typescript-checkJs": "tsc -p jsconfig.json", "test-all": "npm run test && npm run lint && npm run typescript-checkJS && npm run test-esm" }, "files": [ diff --git a/tsconfig.base.json b/tsconfig.base.json new file mode 100644 index 000000000..59aa560f3 --- /dev/null +++ b/tsconfig.base.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "types": [ + "node", + "jest" + ], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "include": [ + "**/*.ts" + ] +} diff --git a/tsconfig.json b/tsconfig.json deleted file mode 100644 index d2688174b..000000000 --- a/tsconfig.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "types": [ - "node", - "jest" - ], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "include": ["**/*.ts"], -}