Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(experimental-utils): moved types eslint-plugin util to experimental-utils #3317

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
649a699
chore(experimental-utils): moved types eslint-plugin util to experime…
lnguyenfln Apr 26, 2021
32bf7ac
Merge branch 'master' into master
bradzacher May 15, 2021
01e026a
feat(experimental-utils): moved types eslint-plugin util to experimen…
lnguyenfln May 19, 2021
95fd90c
feat(experimental-utils): moved types eslint-plugin util to experimen…
lnguyenfln Jun 1, 2021
2a4fd07
feat(experimental-utils): moved types eslint-plugin util to experimen…
lnguyenfln Jun 1, 2021
bed4a9e
feat(experimental-utils): moved types eslint-plugin util to experimen…
detljh Jun 7, 2021
137e3fd
chore(experimental-utils): moved types eslint-plugin util to experime…
lnguyenfln Apr 26, 2021
9f4a4d6
feat(experimental-utils): moved types eslint-plugin util to experimen…
lnguyenfln May 19, 2021
eea8ef6
feat(experimental-utils): moved types eslint-plugin util to experimen…
lnguyenfln Jun 1, 2021
0a7893e
feat(experimental-utils): moved types eslint-plugin util to experimen…
lnguyenfln Jun 1, 2021
13fdf56
feat(experimental-utils): moved types eslint-plugin util to experimen…
detljh Jun 7, 2021
8fb132b
feat(experimental-utils): moved types eslint-plugin util to experimen…
detljh Jun 18, 2021
dd7bce1
Merge branch 'master' of https://github.com/detljh/typescript-eslint
detljh Jun 18, 2021
5ece2d9
feat(experimental-utils): moved types eslint-plugin util to experimen…
lnguyenfln Apr 26, 2021
e7248b5
Merge branch 'master' into master
detljh Jun 21, 2021
77926eb
Merge branch 'master' into master
detljh Jun 29, 2021
fbf346d
Merge branch 'master' into master
detljh Jul 14, 2021
466ed2c
Merge branch 'master' of https://github.com/detljh/typescript-eslint
detljh Jul 14, 2021
2853bde
feat(experimental-utils): moved types eslint-plugin util to experimen…
detljh Jul 14, 2021
be008bf
Merge branch 'main'
armano2 Dec 17, 2021
e2e2903
fix: remove typescript-eslint/parser to dev dep
armano2 Dec 17, 2021
1a47a2a
Merge branch 'main'
armano2 Dec 21, 2021
09d5ee9
fix(eslint-plugin): correct circular dependency
armano2 Dec 21, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/eslint-plugin/src/util/index.ts
Expand Up @@ -12,7 +12,8 @@ export * from './nullThrows';
export * from './objectIterators';
export * from './propertyTypes';
export * from './requiresQuoting';
export * from './types';
// TODO: remove in next major release
export * from '@typescript-eslint/experimental-utils/dist/eslint-utils/types';

// this is done for convenience - saves migrating all of the old rules
const { applyDefault, deepMerge, isObjectNotArray, getParserServices } =
Expand Down
7 changes: 5 additions & 2 deletions packages/experimental-utils/package.json
Expand Up @@ -43,14 +43,17 @@
"@typescript-eslint/scope-manager": "5.8.0",
"@typescript-eslint/types": "5.8.0",
"@typescript-eslint/typescript-estree": "5.8.0",
"debug": "^4.3.1",
"eslint-scope": "^5.1.1",
"eslint-utils": "^3.0.0"
"eslint-utils": "^3.0.0",
"tsutils": "^3.21.0"
},
"peerDependencies": {
"eslint": "^6.0.0 || ^7.0.0 || ^8.0.0"
},
"devDependencies": {
"typescript": "*"
"typescript": "*",
"@typescript-eslint/parser": "^5.8.0"
},
"funding": {
"type": "opencollective",
Expand Down
1 change: 1 addition & 0 deletions packages/experimental-utils/src/eslint-utils/index.ts
Expand Up @@ -5,3 +5,4 @@ export * from './InferTypesFromRule';
export * from './RuleCreator';
export * from './RuleTester';
export * from './deepMerge';
export * from './types';
@@ -1,7 +1,4 @@
import {
AST_NODE_TYPES,
TSESTree,
} from '@typescript-eslint/experimental-utils';
import { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/types';
import debug from 'debug';
import {
isCallExpression,
Expand All @@ -19,7 +16,7 @@ import {
} from 'tsutils';
import * as ts from 'typescript';

const log = debug('typescript-eslint:eslint-plugin:utils:types');
const log = debug('typescript-eslint:experimental-utils:eslint-utils:types');

/**
* Checks if the given type is either an array type,
Expand Down
@@ -1,9 +1,13 @@
import * as ts from 'typescript';
import { TSESTree } from '@typescript-eslint/experimental-utils';
import { parseForESLint } from '@typescript-eslint/parser';
import path from 'path';
import { getFixturesRootDir } from '../RuleTester';
import { isUnsafeAssignment } from '../../src/util/types';
import { TSESTree, ESLintUtils } from '../../src';

import isUnsafeAssignment = ESLintUtils.isUnsafeAssignment;

function getFixturesRootDir(): string {
return path.join(__dirname, '../../../eslint-plugin/tests/fixtures');
}

describe('isUnsafeAssignment', () => {
const rootDir = getFixturesRootDir();
Expand Down
33 changes: 33 additions & 0 deletions packages/experimental-utils/typings/typescript.d.ts
@@ -0,0 +1,33 @@
import 'typescript';

declare module 'typescript' {
interface TypeChecker {
// internal TS APIs

/**
* @returns `true` if the given type is an array type:
* - `Array<foo>`
* - `ReadonlyArray<foo>`
* - `foo[]`
* - `readonly foo[]`
*/
isArrayType(type: Type): type is TypeReference;
/**
* @returns `true` if the given type is a tuple type:
* - `[foo]`
* - `readonly [foo]`
*/
isTupleType(type: Type): type is TupleTypeReference;
/**
* Return the type of the given property in the given type, or undefined if no such property exists
*/
getTypeOfPropertyOfType(type: Type, propertyName: string): Type | undefined;
}

interface Type {
/**
* If the type is `any`, and this is set to "error", then TS was unable to resolve the type
*/
intrinsicName?: string;
}
}