Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(*): change TypeScript version range to >=3.2.1 <3.4.0#184

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
JamesHenry merged 4 commits intomasterfromts-3.3
Feb 4, 2019
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletionsREADME.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,11 +42,13 @@ The `canary` (latest master) version is:

## Supported TypeScript Version

We will always endeavor to support the latest stable version of TypeScript.
We will always endeavor to support the latest stable version of TypeScript. Sometimes, but not always, changes in TypeScript will not require breaking changes in this project, and so we are able to support more than one version of TypeScript.

The version of TypeScript currently supported by this parser is `~3.2.1`. This is reflected in the `devDependency` requirement within the package.json file, and it is what the tests will be run against. We have an open `peerDependency` requirement in order to allow for experimentation on newer/beta versions of TypeScript.
**The versionrangeof TypeScript currently supported by this parser is `>=3.2.1 <3.4.0`.**

If you use a non-supported version of TypeScript, the parser will log a warning to the console.
This is reflected in the `devDependency` requirement within the package.json file, and it is what the tests will be run against. We have an open `peerDependency` requirement in order to allow for experimentation on newer/beta versions of TypeScript.

If you use a non-supported version of TypeScript, the parser will log a warning to the console. If you want to disable this warning, you can configure this in your `parserOptions`. See: [`@typescript-eslint/parser`](./packages/parser/) and [`@typescript-eslint/typescript-estree`](./packages/typescript-estree/).

**Please ensure that you are using a supported version before submitting any issues/bug reports.**

Expand Down
2 changes: 1 addition & 1 deletionpackage.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -69,6 +69,6 @@
"rimraf": "^2.6.3",
"ts-jest": "^23.10.4",
"tslint": "^5.11.0",
"typescript": "~3.2.1"
"typescript": ">=3.2.1 <3.4.0"
}
}
2 changes: 1 addition & 1 deletionpackages/eslint-plugin/package.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -34,6 +34,6 @@
},
"peerDependencies": {
"eslint": "^5.0.0",
"typescript": "~3.2.1"
"typescript": "*"
}
}
2 changes: 2 additions & 0 deletionspackages/parser/README.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -54,6 +54,8 @@ The following additional configuration options are available by specifying them

- **`extraFileExtensions`** - default `undefined`. This option allows you to provide one or more additional file extensions which should be considered in the TypeScript Program compilation. E.g. a `.vue` file

- **`warnOnUnsupportedTypeScriptVersion`** - default `true`. This option allows you to toggle the warning that the parser will give you if you use a version of TypeScript which is not explicitly supported

### .eslintrc.json

```json
Expand Down
1 change: 1 addition & 0 deletionspackages/parser/src/parser-options.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -17,4 +17,5 @@ export interface ParserOptions {
errorOnTypeScriptSyntacticAndSemanticIssues?: boolean;
tsconfigRootDir?: string;
extraFileExtensions?: string[];
warnOnUnsupportedTypeScriptVersion?: boolean;
}
12 changes: 12 additions & 0 deletionspackages/parser/src/parser.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -75,6 +75,18 @@ export function parseForESLint(
}
}

/**
* Allow the user to suppress the warning from typescript-estree if they are using an unsupported
* version of TypeScript
*/
const warnOnUnsupportedTypeScriptVersion = validateBoolean(
options.warnOnUnsupportedTypeScriptVersion,
true
);
if (!warnOnUnsupportedTypeScriptVersion) {
parserOptions.loggerFn = false;
}

const { ast, services } = parseAndGenerateServices(code, parserOptions);
ast.sourceType = options.sourceType;

Expand Down
21 changes: 21 additions & 0 deletionspackages/parser/tests/lib/parser.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -84,4 +84,25 @@ describe('parser', () => {
`"Cannot assign to read only property 'ArrayExpression' of object '#<Object>'"`
);
});

it('`warnOnUnsupportedTypeScriptVersion: false` should set `loggerFn: false` on typescript-estree', () => {
const code = 'const valid = true;';
const spy = jest.spyOn(typescriptESTree, 'parseAndGenerateServices');
parseForESLint(code, { warnOnUnsupportedTypeScriptVersion: true });
expect(spy).toHaveBeenCalledWith(code, {
ecmaFeatures: {},
jsx: false,
sourceType: 'script',
useJSXTextNode: true
});
parseForESLint(code, { warnOnUnsupportedTypeScriptVersion: false });
expect(spy).toHaveBeenCalledWith(code, {
ecmaFeatures: {},
jsx: false,
sourceType: 'script',
useJSXTextNode: true,
loggerFn: false,
warnOnUnsupportedTypeScriptVersion: false
});
});
});
3 changes: 1 addition & 2 deletionspackages/typescript-estree/package.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,7 +42,6 @@
"typescript": "*"
},
"devDependencies": {
"@typescript-eslint/shared-fixtures": "1.2.0",
"typescript": "~3.2.1"
"@typescript-eslint/shared-fixtures": "1.2.0"
}
}
10 changes: 6 additions & 4 deletionspackages/typescript-estree/src/parser.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,9 +18,11 @@ import * as es from './typedefs';
import { Extra, ParserOptions } from './parser-options';
import { getFirstSemanticOrSyntacticError } from './semantic-errors';

const packageJSON = require('../package.json');

const SUPPORTED_TYPESCRIPT_VERSIONS = packageJSON.devDependencies.typescript;
/**
* This needs to be kept in sync with the top-level README.md in the
* typescript-eslint monorepo
*/
const SUPPORTED_TYPESCRIPT_VERSIONS = '>=3.2.1 <3.4.0';
const ACTIVE_TYPESCRIPT_VERSION = ts.version;
const isRunningSupportedTypeScriptVersion = semver.satisfies(
ACTIVE_TYPESCRIPT_VERSION,
Expand DownExpand Up@@ -287,7 +289,7 @@ interface ParseAndGenerateServicesResult<T extends ParserOptions> {
// Public
//------------------------------------------------------------------------------

export const version: string =packageJSON.version;
export const version: string =require('../package.json').version;

export function parse<T extends ParserOptions = ParserOptions>(
code: string,
Expand Down
8 changes: 4 additions & 4 deletionsyarn.lock
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7056,10 +7056,10 @@ typedarray@^0.0.6:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=

typescript@~3.2.1:
version "3.2.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.2.2.tgz#fe8101c46aa123f8353523ebdcf5730c2ae493e5"
integrity sha512-VCj5UiSyHBjwfYacmDuc/NOk4QQixbE+Wn7MFJuS0nRuPQbof132Pw4u53dm264O8LPc2MVsc7RJNml5szurkg==
"typescript@>=3.2.1 <3.4.0":
version "3.3.1"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.3.1.tgz#6de14e1db4b8a006ac535e482c8ba018c55f750b"
integrity sha512-cTmIDFW7O0IHbn1DPYjkiebHxwtCMU+eTy30ZtJNBPF9j2O1ITu5XH2YnBeVRKWHqF+3JQwWJv0Q0aUgX8W7IA==

uglify-js@^3.1.4:
version "3.4.9"
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp