Skip to content

Commit

Permalink
chore: use @tsconfig/node14 and stricter TS config (#1242)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Sep 10, 2022
1 parent 43f7ccc commit 7f3cc12
Show file tree
Hide file tree
Showing 14 changed files with 29 additions and 17 deletions.
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -108,6 +108,7 @@
"@schemastore/package": "^0.0.6",
"@semantic-release/changelog": "^6.0.0",
"@semantic-release/git": "^10.0.0",
"@tsconfig/node14": "^1.0.3",
"@types/dedent": "^0.7.0",
"@types/jest": "^29.0.0",
"@types/node": "^14.18.26",
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
@@ -1,6 +1,6 @@
import { readdirSync } from 'fs';
import { join, parse } from 'path';
import { TSESLint } from '@typescript-eslint/utils';
import type { TSESLint } from '@typescript-eslint/utils';
import globals from './globals.json';
import * as snapshotProcessor from './processors/snapshot-processor';

Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-commented-out-tests.ts
@@ -1,4 +1,4 @@
import { TSESTree } from '@typescript-eslint/utils';
import type { TSESTree } from '@typescript-eslint/utils';
import { createRule } from './utils';

function hasTests(node: TSESTree.Comment) {
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-conditional-in-test.ts
@@ -1,4 +1,4 @@
import { TSESTree } from '@typescript-eslint/utils';
import type { TSESTree } from '@typescript-eslint/utils';
import { createRule, isTypeOfJestFnCall } from './utils';

export default createRule({
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-mocks-import.ts
@@ -1,5 +1,5 @@
import { posix } from 'path';
import { TSESTree } from '@typescript-eslint/utils';
import type { TSESTree } from '@typescript-eslint/utils';
import { createRule, getStringValue, isStringNode } from './utils';

const mocksDirName = '__mocks__';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/prefer-each.ts
@@ -1,4 +1,4 @@
import { TSESTree } from '@typescript-eslint/utils';
import type { TSESTree } from '@typescript-eslint/utils';
import { JestFnType, createRule, parseJestFnCall } from './utils';

export default createRule({
Expand Down
2 changes: 1 addition & 1 deletion src/rules/prefer-lowercase-title.ts
@@ -1,4 +1,4 @@
import { TSESLint, TSESTree } from '@typescript-eslint/utils';
import type { TSESLint, TSESTree } from '@typescript-eslint/utils';
import {
CallExpressionWithSingleArgument,
DescribeAlias,
Expand Down
2 changes: 1 addition & 1 deletion src/rules/require-top-level-describe.ts
@@ -1,4 +1,4 @@
import { TSESTree } from '@typescript-eslint/utils';
import type { TSESTree } from '@typescript-eslint/utils';
import { createRule, isTypeOfJestFnCall, parseJestFnCall } from './utils';

const messages = {
Expand Down
2 changes: 1 addition & 1 deletion src/rules/utils/__tests__/detectJestVersion.test.ts
Expand Up @@ -2,7 +2,7 @@ import { spawnSync } from 'child_process';
import * as fs from 'fs';
import * as os from 'os';
import * as path from 'path';
import { JSONSchemaForNPMPackageJsonFiles } from '@schemastore/package';
import type { JSONSchemaForNPMPackageJsonFiles } from '@schemastore/package';
import { create } from 'ts-node';
import { detectJestVersion } from '../detectJestVersion';

Expand Down
4 changes: 2 additions & 2 deletions src/rules/utils/__tests__/parseJestFnCall.test.ts
@@ -1,4 +1,4 @@
import { JSONSchemaForNPMPackageJsonFiles } from '@schemastore/package';
import type { JSONSchemaForNPMPackageJsonFiles } from '@schemastore/package';
import { TSESLint, TSESTree } from '@typescript-eslint/utils';
import dedent from 'dedent';
import { espreeParser } from '../../__tests__/test-utils';
Expand Down Expand Up @@ -76,7 +76,7 @@ const rule = createRule({
messageId: 'details',
node,
data: {
data: JSON.stringify(sorted, (key, value) => {
data: JSON.stringify(sorted, (_key, value) => {
if (isNode(value)) {
if (isSupportedAccessor(value)) {
return getAccessorValue(value);
Expand Down
2 changes: 1 addition & 1 deletion src/rules/utils/detectJestVersion.ts
@@ -1,4 +1,4 @@
import { JSONSchemaForNPMPackageJsonFiles } from '@schemastore/package';
import type { JSONSchemaForNPMPackageJsonFiles } from '@schemastore/package';

export type JestVersion =
| 14
Expand Down
2 changes: 1 addition & 1 deletion tools/regenerate-docs.ts
Expand Up @@ -2,7 +2,7 @@

import * as fs from 'fs';
import * as path from 'path';
import { TSESLint } from '@typescript-eslint/utils';
import type { TSESLint } from '@typescript-eslint/utils';
import prettier, { Options } from 'prettier';
import { prettier as prettierRC } from '../package.json';
import config from '../src/index';
Expand Down
18 changes: 14 additions & 4 deletions tsconfig.json
@@ -1,15 +1,25 @@
{
"extends": "@tsconfig/node14/tsconfig.json",
"compilerOptions": {
"target": "es2015",
"module": "commonjs",
"moduleResolution": "node",
"lib": ["es2018"],
"noEmit": true,
"importsNotUsedAsValues": "error",
"stripInternal": true,

/* Additional Checks */
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,

"strict": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"isolatedModules": true,
"skipLibCheck": false,
"forceConsistentCasingInFileNames": true
},
"include": ["src/**/*", "tools/**/*"]
"include": ["src/**/*", "tools/**/*"],
"exclude": ["src/rules/__tests__/fixtures/**/*"]
}
3 changes: 2 additions & 1 deletion yarn.lock
Expand Up @@ -2506,7 +2506,7 @@ __metadata:
languageName: node
linkType: hard

"@tsconfig/node14@npm:^1.0.0":
"@tsconfig/node14@npm:^1.0.0, @tsconfig/node14@npm:^1.0.3":
version: 1.0.3
resolution: "@tsconfig/node14@npm:1.0.3"
checksum: 19275fe80c4c8d0ad0abed6a96dbf00642e88b220b090418609c4376e1cef81bf16237bf170ad1b341452feddb8115d8dd2e5acdfdea1b27422071163dc9ba9d
Expand Down Expand Up @@ -4570,6 +4570,7 @@ __metadata:
"@schemastore/package": ^0.0.6
"@semantic-release/changelog": ^6.0.0
"@semantic-release/git": ^10.0.0
"@tsconfig/node14": ^1.0.3
"@types/dedent": ^0.7.0
"@types/jest": ^29.0.0
"@types/node": ^14.18.26
Expand Down

0 comments on commit 7f3cc12

Please sign in to comment.