-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat: bump supported TS version to 5.2 #7535
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import type { TSESTree } from '@typescript-eslint/types'; | ||
import { AST_TOKEN_TYPES } from '@typescript-eslint/types'; | ||
import { ESLint } from '@typescript-eslint/utils/ts-eslint'; | ||
import * as fs from 'fs'; | ||
import * as path from 'path'; | ||
import { format, resolveConfig } from 'prettier'; | ||
|
@@ -53,6 +54,7 @@ const TYPES_FILE = path.resolve( | |
'src', | ||
'lib.ts', | ||
); | ||
const BARREL_PATH = path.join(OUTPUT_FOLDER, 'index.ts'); | ||
|
||
const BASE_CONFIG_MODULE_NAME = 'base-config'; | ||
const SHARED_CONFIG_MODULE = path.resolve( | ||
|
@@ -110,7 +112,7 @@ function getReferences( | |
return references; | ||
} | ||
|
||
function main(): void { | ||
async function main(): Promise<void> { | ||
try { | ||
rimraf.sync(OUTPUT_FOLDER); | ||
} catch { | ||
|
@@ -122,6 +124,12 @@ function main(): void { | |
// ignored | ||
} | ||
|
||
const filesWritten: string[] = [ | ||
SHARED_CONFIG_MODULE, | ||
TYPES_FILE, | ||
BARREL_PATH, | ||
]; | ||
|
||
// the shared | ||
fs.writeFileSync( | ||
SHARED_CONFIG_MODULE, | ||
|
@@ -222,7 +230,9 @@ function main(): void { | |
} | ||
|
||
const formattedCode = formatCode(code); | ||
fs.writeFileSync(path.join(OUTPUT_FOLDER, `${libName}.ts`), formattedCode); | ||
const writePath = path.join(OUTPUT_FOLDER, `${libName}.ts`); | ||
fs.writeFileSync(writePath, formattedCode); | ||
filesWritten.push(writePath); | ||
|
||
console.log( | ||
'Wrote', | ||
|
@@ -254,7 +264,7 @@ function main(): void { | |
|
||
const formattedBarrelCode = formatCode(barrelCode); | ||
|
||
fs.writeFileSync(path.join(OUTPUT_FOLDER, 'index.ts'), formattedBarrelCode); | ||
fs.writeFileSync(BARREL_PATH, formattedBarrelCode); | ||
console.log('Wrote barrel file'); | ||
|
||
// generate a string union type for the lib names | ||
|
@@ -270,6 +280,17 @@ function main(): void { | |
|
||
fs.writeFileSync(TYPES_FILE, formattedLibUnionCode); | ||
console.log('Wrote Lib union type file'); | ||
|
||
const lint = new ESLint({ | ||
fix: true, | ||
}); | ||
const results = await lint.lintFiles(filesWritten); | ||
await ESLint.outputFixes(results); | ||
console.log('Autofixed lint errors'); | ||
} | ||
|
||
main(); | ||
main().catch(e => { | ||
console.error(e); | ||
// eslint-disable-next-line no-process-exit | ||
process.exit(1); | ||
}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's going on here? Is it related to #7534? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nah so I ran the generator and noticed that it changed all of the lib files and caused a bunch of lint errors due to unsorted imports and such. I figured that instead of manually running the linter afterwards was dumb cos we can automate it :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bradzacher this seem to be generating some issues on clean install