Skip to content

Commit

Permalink
fix: import typescript using default (#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
RebeccaStevens authored Mar 13, 2023
1 parent 3ca9d55 commit cf3a665
Show file tree
Hide file tree
Showing 26 changed files with 127 additions and 24 deletions.
12 changes: 12 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ module.exports = {
"regexp",
"simple-import-sort",
"typescript-sort-keys",
"unicorn",
"vitest",
],
root: true,
Expand All @@ -74,6 +75,17 @@ module.exports = {
"no-only-tests/no-only-tests": "error",
"simple-import-sort/exports": "error",
"simple-import-sort/imports": "error",
"unicorn/import-style": [
"error",
{
extendDefaultStyles: false,
styles: {
typescript: {
default: true,
},
},
},
],

// These on-by-default rules don't work well for this repo and we like them off.
"no-inner-declarations": "off",
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"eslint-plugin-regexp": "^1.12.0",
"eslint-plugin-simple-import-sort": "^10.0.0",
"eslint-plugin-typescript-sort-keys": "^2.1.0",
"eslint-plugin-unicorn": "^46.0.0",
"eslint-plugin-vitest": "^0.0.54",
"http-serve": "^1.0.1",
"husky": "^8.0.3",
Expand Down
92 changes: 91 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/comments.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Code largely based on https://github.com/ajafff/tsutils
// Original license: https://github.com/ajafff/tsutils/blob/26b195358ec36d59f00333115aa3ffd9611ca78b/LICENSE

import * as ts from "typescript";
import ts from "typescript";

import { forEachToken } from "./tokens.js";

Expand Down
2 changes: 1 addition & 1 deletion src/compilerOptions.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Code largely based on https://github.com/ajafff/tsutils
// Original license: https://github.com/ajafff/tsutils/blob/26b195358ec36d59f00333115aa3ffd9611ca78b/LICENSE

import * as ts from "typescript";
import ts from "typescript";
import { describe, expect, it } from "vitest";

import {
Expand Down
2 changes: 1 addition & 1 deletion src/compilerOptions.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Code largely based on https://github.com/ajafff/tsutils
// Original license: https://github.com/ajafff/tsutils/blob/26b195358ec36d59f00333115aa3ffd9611ca78b/LICENSE

import * as ts from "typescript";
import ts from "typescript";

/**
* An option that can be tested with {@link isCompilerOptionEnabled}.
Expand Down
2 changes: 1 addition & 1 deletion src/flags.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Code largely based on https://github.com/ajafff/tsutils
// Original license: https://github.com/ajafff/tsutils/blob/26b195358ec36d59f00333115aa3ffd9611ca78b/LICENSE

import * as ts from "typescript";
import ts from "typescript";

/**
* Test if the given flag is set on the combined flags.
Expand Down
2 changes: 1 addition & 1 deletion src/modifiers.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Code largely based on https://github.com/ajafff/tsutils
// Original license: https://github.com/ajafff/tsutils/blob/26b195358ec36d59f00333115aa3ffd9611ca78b/LICENSE

import * as ts from "typescript";
import ts from "typescript";

/**
* Test if the given iterable includes a modifier of any of the given kinds.
Expand Down
2 changes: 1 addition & 1 deletion src/nodes/typeGuards/compound.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as ts from "typescript";
import ts from "typescript";
import { describe, expect, it } from "vitest";

import { createNode } from "../../test/utils.js";
Expand Down
2 changes: 1 addition & 1 deletion src/nodes/typeGuards/compound.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as ts from "typescript";
import ts from "typescript";

import { isSuperExpression } from "./single.js";
import {
Expand Down
2 changes: 1 addition & 1 deletion src/nodes/typeGuards/single.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as ts from "typescript";
import ts from "typescript";

/**
* A node that represents the any keyword.
Expand Down
2 changes: 1 addition & 1 deletion src/nodes/typeGuards/union.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as ts from "typescript";
import ts from "typescript";

import { isTsVersionAtLeast } from "../../utils.js";
import {
Expand Down
2 changes: 1 addition & 1 deletion src/nodes/utilities.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Code largely based on https://github.com/ajafff/tsutils
// Original license: https://github.com/ajafff/tsutils/blob/26b195358ec36d59f00333115aa3ffd9611ca78b/LICENSE

import * as ts from "typescript";
import ts from "typescript";

import {
isConstAssertionExpression,
Expand Down
2 changes: 1 addition & 1 deletion src/scopes.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Code largely based on https://github.com/ajafff/tsutils
// Original license: https://github.com/ajafff/tsutils/blob/26b195358ec36d59f00333115aa3ffd9611ca78b/LICENSE

import * as ts from "typescript";
import ts from "typescript";

/**
* Is the node a scope boundary, specifically due to it being a function.
Expand Down
2 changes: 1 addition & 1 deletion src/syntax.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as ts from "typescript";
import ts from "typescript";
import { describe, expect, it } from "vitest";

import {
Expand Down
2 changes: 1 addition & 1 deletion src/syntax.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Code largely based on https://github.com/ajafff/tsutils
// Original license: https://github.com/ajafff/tsutils/blob/26b195358ec36d59f00333115aa3ffd9611ca78b/LICENSE

import * as ts from "typescript";
import ts from "typescript";

/**
* Test of the kind given is for assignment.
Expand Down
2 changes: 1 addition & 1 deletion src/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Original license MIT:
// https://github.com/ajafff/tsutils/blob/26b195358ec36d59f00333115aa3ffd9611ca78b/LICENSE

import * as ts from "typescript";
import ts from "typescript";

import { isTsVersionAtLeast } from "./utils.js";

Expand Down
2 changes: 1 addition & 1 deletion src/types/getters.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as ts from "typescript";
import ts from "typescript";
import { describe, expect, it } from "vitest";

import { createSourceFileAndTypeChecker } from "../test/utils.js";
Expand Down
2 changes: 1 addition & 1 deletion src/types/getters.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Code largely based on https://github.com/ajafff/tsutils
// Original license: https://github.com/ajafff/tsutils/blob/26b195358ec36d59f00333115aa3ffd9611ca78b/LICENSE

import * as ts from "typescript";
import ts from "typescript";

import { isNamedDeclarationWithName } from "../nodes/typeGuards/index.js";
import {
Expand Down
2 changes: 1 addition & 1 deletion src/types/typeGuards/compound.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as ts from "typescript";
import ts from "typescript";
import { describe, expect, it } from "vitest";

import { createSourceFileAndTypeChecker } from "../../test/utils.js";
Expand Down
2 changes: 1 addition & 1 deletion src/types/typeGuards/compound.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as ts from "typescript";
import ts from "typescript";

import { isTypeFlagSet } from "../../flags.js";
import { isTupleType, isTypeReference } from "./objects.js";
Expand Down
2 changes: 1 addition & 1 deletion src/types/typeGuards/objects.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as ts from "typescript";
import ts from "typescript";

import { isObjectFlagSet } from "../../flags.js";
import { isObjectType } from "./simple.js";
Expand Down
2 changes: 1 addition & 1 deletion src/types/typeGuards/simple.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as ts from "typescript";
import ts from "typescript";
import { describe, expect, it } from "vitest";

import { createSourceFileAndTypeChecker } from "../../test/utils.js";
Expand Down
2 changes: 1 addition & 1 deletion src/types/utilities.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as ts from "typescript";
import ts from "typescript";
import { describe, expect, it } from "vitest";

import { createSourceFileAndTypeChecker } from "../test/utils.js";
Expand Down
2 changes: 1 addition & 1 deletion src/types/utilities.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Code largely based on https://github.com/ajafff/tsutils
// Original license: https://github.com/ajafff/tsutils/blob/26b195358ec36d59f00333115aa3ffd9611ca78b/LICENSE

import * as ts from "typescript";
import ts from "typescript";

import {
isModifierFlagSet,
Expand Down
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as ts from "typescript";
import ts from "typescript";

const [tsMajor, tsMinor] = ts.versionMajorMinor
.split(".")
Expand Down

0 comments on commit cf3a665

Please sign in to comment.