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: support TypeScript 4.8#5551

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
bradzacher merged 8 commits intomainfromsupport-TS4.8
Aug 29, 2022
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
12 changes: 8 additions & 4 deletions.eslintrc.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
module.exports = {
root: true,
plugins: [
'eslint-plugin',
'@typescript-eslint',
'jest',
'import',
'eslint-comments',
'@typescript-eslint/internal',
'deprecation',
'eslint-comments',
'eslint-plugin',
'import',
'jest',
'simple-import-sort',
],
env: {
Expand DownExpand Up@@ -41,6 +42,9 @@ module.exports = {
EXPERIMENTAL_useSourceOfProjectReferenceRedirect: false,
},
rules: {
// make sure we're not leveraging any deprecated APIs
'deprecation/deprecation': 'error',

//
// our plugin :D
//
Expand Down
1 change: 1 addition & 0 deletions.github/actions/prepare-install/action.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -44,3 +44,4 @@ runs:
run: |
yarn --ignore-engines --frozen-lockfile --ignore-scripts
yarn check-clean-workspace-after-install
yarn patch-package
2 changes: 1 addition & 1 deletionREADME.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -51,7 +51,7 @@ The latest version under the `canary` tag **(latest commit to `main`)** is:

### Supported TypeScript Version

**The version range of TypeScript currently supported by this parser is `>=3.3.1 <4.8.0`.**
**The version range of TypeScript currently supported by this parser is `>=3.3.1 <4.9.0`.**

These versions are what we test against.

Expand Down
4 changes: 0 additions & 4 deletions_redirects
View file
Open in desktop

This file was deleted.

25 changes: 25 additions & 0 deletionsnetlify.toml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
# https://docs.netlify.com/configure-builds/file-based-configuration/#build-settings
[build]
base = ""
publish = "packages/website/build"
command = "NX_VERBOSE_LOGGING=true yarn patch-package && yarn nx build website"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Non-blocking: We could potentially remove the opt-in verbose logging, it was only needed while troubleshooting something a long while back

bradzacher reacted with thumbs up emoji
[build.environment]
NETLIFY_USE_YARN = "true"
YARN_FLAGS = "--ignore-scripts"

# https://docs.netlify.com/configure-builds/file-based-configuration/#redirects
[[redirects]]
from = "/docs/linting"
to = "/docs"

[[redirects]]
from = "/docs/linting/type-linting"
to = "/docs/linting/typed-linting"

[[redirects]]
from = "/docs/linting/monorepo"
to = "/docs/linting/typed-linting/monorepos"

[[redirects]]
from = "/docs/linting/tslint"
to = "/docs/linting/troubleshooting/tslint"
11 changes: 7 additions & 4 deletionspackage.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,11 +33,12 @@
"generate-contributors": "yarn ts-node --transpile-only ./tools/generate-contributors.ts",
"generate-sponsors": "yarn ts-node --transpile-only ./tools/generate-sponsors.ts",
"generate-website-dts": "yarn ts-node --transpile-only ./tools/generate-website-dts.ts",
"generate-lib": "nx generate-lib @typescript-eslint/scope-manager",
"lint-fix": "eslint . --fix",
"lint-markdown-fix": "yarn lint-markdown --fix",
"lint-markdown": "markdownlint \"**/*.md\" --config=.markdownlint.json --ignore-path=.markdownlintignore",
"lint": "cross-env NODE_OPTIONS=\"--max-old-space-size=16384\" eslint .",
"postinstall": "yarn husky install && yarn build",
"postinstall": "yarnpatch-package && yarnhusky install && yarn build",
"pre-commit": "yarn lint-staged",
"start": "nx run website:start",
"test": "nx run-many --target=test --all --parallel",
Expand DownExpand Up@@ -77,9 +78,10 @@
"cross-env": "^7.0.3",
"cross-fetch": "^3.1.5",
"cspell": "^5.20.0",
"downlevel-dts": "^0.9.0",
"downlevel-dts": ">=0.10.0",
"enhanced-resolve": "^5.9.3",
"eslint": "^8.15.0",
"eslint-plugin-deprecation": "^1.3.2",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-eslint-plugin": "^5.0.1",
"eslint-plugin-import": "^2.26.0",
Expand All@@ -96,16 +98,17 @@
"make-dir": "^3.1.0",
"markdownlint-cli": "^0.31.1",
"ncp": "^2.0.0",
"patch-package": "^6.4.7",
"prettier": "2.7.1",
"pretty-format": "^28.1.0",
"rimraf": "^3.0.2",
"tmp": "^0.2.1",
"ts-node": "^10.7.0",
"tslint": "^6.1.3",
"typescript": ">=3.3.1 <4.8.0"
"typescript": ">=3.3.1 <4.9.0"
},
"resolutions": {
"typescript": "4.7.4",
"typescript": "4.8.2",
"@types/node": "^17.0.31",
"pretty-format": "^28.1.0",
"//": "Pin jest to v28 across the repo",
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -157,7 +157,7 @@ export default createRule<Options, MessageIds>({
return format(code, {
...prettierConfig,
parser: 'typescript',
}).trimRight(); // prettier will insert a new line at the end of the code
}).trimEnd(); // prettier will insert a new line at the end of the code
} catch (ex) {
// adapted from https://github.com/prettier/eslint-plugin-prettier/blob/185b1064d3dd674538456fb2fad97fbfcde49e0d/eslint-plugin-prettier.js#L242-L257
if (!(ex instanceof SyntaxError)) {
Expand DownExpand Up@@ -282,9 +282,9 @@ export default createRule<Options, MessageIds>({
const lines = text.split('\n');
const lastLine = lines[lines.length - 1];
// prettier will trim out the end of line on save, but eslint will check before then
const isStartEmpty = lines[0].trimRight() === '';
const isStartEmpty = lines[0].trimEnd() === '';
// last line can be indented
const isEndEmpty = lastLine.trimLeft() === '';
const isEndEmpty = lastLine.trimStart() === '';
if (!isStartEmpty || !isEndEmpty) {
// multiline template strings must have an empty first/last line
return context.report({
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,7 +15,7 @@ const printNodeModifiers = (
): string =>
`${node.accessibility ?? ''}${
node.static ? ' static' : ''
} ${final} `.trimLeft();
} ${final} `.trimStart();

const isSupportedLiteral = (
node: TSESTree.Node,
Expand Down
2 changes: 2 additions & 0 deletionspackages/eslint-plugin/src/rules/comma-spacing.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -110,6 +110,7 @@ export default createRule<Options, MessageIds>({
if (
prevToken &&
isTokenOnSameLine(prevToken, commaToken) &&
// eslint-disable-next-line deprecation/deprecation -- TODO - switch once our min ESLint version is 6.7.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Sorry if I'm forgetting something obvious, what was the line in the sand on ESLint versions here? Is it documented somewhere else?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Oh I see I found it on eslint.org,isSpaceBetweenTokens() - replaced by isSpaceBetween()

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

yeah it's marked as deprecated in our types.
in the next major we'll probably do a massive bump to a higher ESLint version (maybe 6.7?) to enable us to switch to these new APIs and clean house as well.

spaceBefore !== sourceCode.isSpaceBetweenTokens(prevToken, commaToken)
) {
context.report({
Expand DownExpand Up@@ -139,6 +140,7 @@ export default createRule<Options, MessageIds>({
if (
nextToken &&
isTokenOnSameLine(commaToken, nextToken) &&
// eslint-disable-next-line deprecation/deprecation -- TODO - switch once our min ESLint version is 6.7.0
spaceAfter !== sourceCode.isSpaceBetweenTokens(commaToken, nextToken)
) {
context.report({
Expand Down
12 changes: 7 additions & 5 deletionspackages/eslint-plugin/src/rules/dot-notation.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,6 +4,7 @@ import * as tsutils from 'tsutils';
import { getESLintCoreRule } from '../util/getESLintCoreRule';
import {
createRule,
getModifiers,
getParserServices,
InferMessageIdsTypeFromRule,
InferOptionsTypeFromRule,
Expand DownExpand Up@@ -95,13 +96,14 @@ export default createRule<Options, MessageIds>({
const propertySymbol = typeChecker.getSymbolAtLocation(
esTreeNodeToTSNodeMap.get(node.property),
);
const modifierKind =
propertySymbol?.getDeclarations()?.[0]?.modifiers?.[0].kind;
const modifierKind = getModifiers(
propertySymbol?.getDeclarations()?.[0],
)?.[0].kind;
if (
(allowPrivateClassPropertyAccess &&
modifierKind == ts.SyntaxKind.PrivateKeyword) ||
modifierKind === ts.SyntaxKind.PrivateKeyword) ||
(allowProtectedClassPropertyAccess &&
modifierKind == ts.SyntaxKind.ProtectedKeyword)
modifierKind === ts.SyntaxKind.ProtectedKeyword)
) {
return;
}
Expand All@@ -115,7 +117,7 @@ export default createRule<Options, MessageIds>({
const indexType = objectType
.getNonNullableType()
.getStringIndexType();
if (indexType != undefined) {
if (indexType !== undefined) {
return;
}
}
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -230,7 +230,7 @@ export default util.createRule({
break;
}
const { rightText, shouldBreak } = breakIfInvalid({
rightNode: current.right as ValidChainTarget,
rightNode: current.right,
previousLeftText,
});
if (shouldBreak) {
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -46,6 +46,7 @@ export default util.createRule<Options, MessageIds>({
): void {
const precedingToken = sourceCode.getTokenBefore(node);
if (precedingToken && util.isTokenOnSameLine(precedingToken, node)) {
// eslint-disable-next-line deprecation/deprecation -- TODO - switch once our min ESLint version is 6.7.0
const hasSpace = sourceCode.isSpaceBetweenTokens(
precedingToken,
node as TSESTree.Token,
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -146,6 +146,7 @@ export default util.createRule<Options, MessageIds>({
rightToken = sourceCode.getFirstToken(node, util.isOpeningParenToken)!;
leftToken = sourceCode.getTokenBefore(rightToken)!;
}
// eslint-disable-next-line deprecation/deprecation -- TODO - switch once our min ESLint version is 6.7.0
const hasSpacing = sourceCode.isSpaceBetweenTokens(leftToken, rightToken);

if (hasSpacing && functionConfig === 'never') {
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -180,6 +180,7 @@ export default util.createRule<Options, MessageIds>({

if (type === ':' && previousToken.value === '?') {
if (
// eslint-disable-next-line deprecation/deprecation -- TODO - switch once our min ESLint version is 6.7.0
sourceCode.isSpaceBetweenTokens(previousToken, punctuatorTokenStart)
) {
context.report({
Expand Down
3 changes: 2 additions & 1 deletionpackages/eslint-plugin/src/rules/unbound-method.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,7 @@ import { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/utils';
import * as tsutils from 'tsutils';
import * as ts from 'typescript';
import * as util from '../util';
import { getModifiers } from '../util';

//------------------------------------------------------------------------------
// Rule Definition
Expand DownExpand Up@@ -285,7 +286,7 @@ function checkMethod(
!(
ignoreStatic &&
tsutils.hasModifier(
valueDeclaration.modifiers,
getModifiers(valueDeclaration),
ts.SyntaxKind.StaticKeyword,
)
),
Expand Down
6 changes: 3 additions & 3 deletionspackages/eslint-plugin/src/util/index.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,11 +7,11 @@ export * from './getFunctionHeadLoc';
export * from './getOperatorPrecedence';
export * from './getThisExpression';
export * from './getWrappingFixer';
export * from './misc';
export * from './objectIterators';
export * from './isNodeEqual';
export * from './isNullLiteral';
export * from './isUndefinedIdentifier';
export * from './isNodeEqual';
export * from './misc';
export * from './objectIterators';

// this is done for convenience - saves migrating all of the old rules
export * from '@typescript-eslint/type-utils';
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -69,7 +69,7 @@ ruleTester.run('consistent-type-assertions', rule, {
],
}),
...batchedSingleLineTests({
code: `${OBJECT_LITERAL_AS_CASTS.trimRight()}${OBJECT_LITERAL_ARGUMENT_AS_CASTS}`,
code: `${OBJECT_LITERAL_AS_CASTS.trimEnd()}${OBJECT_LITERAL_ARGUMENT_AS_CASTS}`,
options: [
{
assertionStyle: 'as',
Expand All@@ -78,7 +78,7 @@ ruleTester.run('consistent-type-assertions', rule, {
],
}),
...batchedSingleLineTests({
code: `${OBJECT_LITERAL_ANGLE_BRACKET_CASTS.trimRight()}${OBJECT_LITERAL_ARGUMENT_ANGLE_BRACKET_CASTS}`,
code: `${OBJECT_LITERAL_ANGLE_BRACKET_CASTS.trimEnd()}${OBJECT_LITERAL_ARGUMENT_ANGLE_BRACKET_CASTS}`,
options: [
{
assertionStyle: 'angle-bracket',
Expand DownExpand Up@@ -287,7 +287,7 @@ ruleTester.run('consistent-type-assertions', rule, {
],
}),
...batchedSingleLineTests({
code: `${OBJECT_LITERAL_AS_CASTS.trimRight()}${OBJECT_LITERAL_ARGUMENT_AS_CASTS}`,
code: `${OBJECT_LITERAL_AS_CASTS.trimEnd()}${OBJECT_LITERAL_ARGUMENT_AS_CASTS}`,
options: [
{
assertionStyle: 'as',
Expand DownExpand Up@@ -330,7 +330,7 @@ ruleTester.run('consistent-type-assertions', rule, {
],
}),
...batchedSingleLineTests({
code: `${OBJECT_LITERAL_ANGLE_BRACKET_CASTS.trimRight()}${OBJECT_LITERAL_ARGUMENT_ANGLE_BRACKET_CASTS}`,
code: `${OBJECT_LITERAL_ANGLE_BRACKET_CASTS.trimEnd()}${OBJECT_LITERAL_ARGUMENT_ANGLE_BRACKET_CASTS}`,
options: [
{
assertionStyle: 'angle-bracket',
Expand Down
20 changes: 10 additions & 10 deletionspackages/eslint-plugin/tests/rules/prefer-as-const.test.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -217,7 +217,7 @@ ruleTester.run('prefer-as-const', rule, {
class foo {
bar: 'baz' = 'baz';
}
`.trimRight(),
`,
output: null,
errors: [
{
Expand All@@ -231,7 +231,7 @@ class foo {
class foo {
bar = 'baz' as const;
}
`.trimRight(),
`,
},
],
},
Expand All@@ -242,7 +242,7 @@ class foo {
class foo {
bar: 2 = 2;
}
`.trimRight(),
`,
output: null,
errors: [
{
Expand All@@ -256,7 +256,7 @@ class foo {
class foo {
bar = 2 as const;
}
`.trimRight(),
`,
},
],
},
Expand All@@ -267,12 +267,12 @@ class foo {
class foo {
foo = <'bar'>'bar';
}
`.trimRight(),
`,
output: `
class foo {
foo = <const>'bar';
}
`.trimRight(),
`,
errors: [
{
messageId: 'preferConstAssertion',
Expand All@@ -286,12 +286,12 @@ class foo {
class foo {
foo = 'bar' as 'bar';
}
`.trimRight(),
`,
output: `
class foo {
foo = 'bar' as const;
}
`.trimRight(),
`,
errors: [
{
messageId: 'preferConstAssertion',
Expand All@@ -305,12 +305,12 @@ class foo {
class foo {
foo = 5 as 5;
}
`.trimRight(),
`,
output: `
class foo {
foo = 5 as const;
}
`.trimRight(),
`,
errors: [
{
messageId: 'preferConstAssertion',
Expand Down
3 changes: 0 additions & 3 deletionspackages/scope-manager/src/lib/dom.iterable.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -30,9 +30,6 @@ export const dom_iterable = {
Headers: TYPE,
IDBDatabase: TYPE,
IDBObjectStore: TYPE,
MIDIInputMap: TYPE,
MIDIOutput: TYPE,
MIDIOutputMap: TYPE,
MediaKeyStatusMap: TYPE,
MediaList: TYPE,
MessageEvent: TYPE,
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp