@@ -5,10 +5,10 @@ import chalk from 'chalk'
55import exec from 'execa'
66import GitUrlParse from 'git-url-parse'
77import { exists , mkdir , readFile , writeFile } from 'mz/fs'
8- import { JsonSchemaForNpmPackageJsonFiles } from './package-schema'
8+ import { JSONSchemaForNPMPackageJsonFiles } from './package-schema'
99import * as prompt from './prompt'
10- import { JsonSchemaForTheTypeScriptCompilersConfigurationFile } from './tsconfig-schema'
11- import { JsonSchemaForTheTsLintConfigurationFiles } from './tslint -schema'
10+ import { JSONSchemaForTheTypeScriptCompilerSConfigurationFile } from './tsconfig-schema'
11+ import { JSONSchemaForESLintConfigurationFiles } from './eslintrc -schema'
1212
1313interface Repository {
1414 type: string
@@ -104,12 +104,12 @@ async function main(): Promise<void> {
104104 if ( await exists ( 'tsconfig.json' ) ) {
105105 console . log ( '📄 tsconfig.json already exists, skipping creation' )
106106 } else {
107- const tsconfigJson : JsonSchemaForTheTypeScriptCompilersConfigurationFile = {
107+ const tsconfigJson : JSONSchemaForTheTypeScriptCompilerSConfigurationFile = {
108108 extends : './node_modules/@sourcegraph/tsconfig/tsconfig.json' ,
109109 compilerOptions : {
110- target : 'es2016 ' ,
111- module : 'esnext ' ,
112- moduleResolution : 'node ' ,
110+ target : 'ES2019 ' ,
111+ module : 'ESNext ' ,
112+ moduleResolution : 'Node ' ,
113113 sourceMap : true ,
114114 declaration : true ,
115115 outDir : 'dist' ,
@@ -122,14 +122,17 @@ async function main(): Promise<void> {
122122 await writeFile ( 'tsconfig.json' , JSON . stringify ( tsconfigJson , null , 2 ) )
123123 }
124124
125- if ( await exists ( 'tslint .json' ) ) {
126- console . log ( '📄 tslint .json already exists, skipping creation' )
125+ if ( await exists ( 'eslint .json' ) ) {
126+ console . log ( '📄 eslint .json already exists, skipping creation' )
127127 } else {
128- console . log ( '📄 Adding tslint.json' )
129- const tslintJson : JsonSchemaForTheTsLintConfigurationFiles = {
130- extends : [ '@sourcegraph/tslint-config' ] ,
128+ console . log ( '📄 Adding .eslintrc.json' )
129+ const eslintJson : JSONSchemaForESLintConfigurationFiles = {
130+ extends : [ '@sourcegraph/eslint-config' ] ,
131+ parserOptions : {
132+ project : 'tsconfig.json' ,
133+ } ,
131134 }
132- await writeFile ( 'tslint .json' , JSON . stringify ( tslintJson , null , 2 ) )
135+ await writeFile ( 'eslint .json' , JSON . stringify ( eslintJson , null , 2 ) )
133136 }
134137
135138 console . log ( '📄 Adding .editorconfig' )
@@ -154,13 +157,13 @@ async function main(): Promise<void> {
154157 )
155158
156159 console . log ( '📄 Adding .gitignore' )
157- await writeFile ( '.gitignore' , [ 'dist/' , 'node_modules/' , '.cache/' , '' ] . join ( '\n' ) )
160+ await writeFile ( '.gitignore' , [ 'dist/' , 'node_modules/' , '.cache/' , 'yarn.lock' , ' '] . join ( '\n' ) )
158161
159162 if ( await exists ( 'package.json' ) ) {
160163 console . log ( '📄 package.json already exists, skipping creation' )
161164 } else {
162165 console . log ( '📄 Adding package.json' )
163- const packageJson : JsonSchemaForNpmPackageJsonFiles = {
166+ const packageJson : JSONSchemaForNPMPackageJsonFiles = {
164167 $schema : schema ,
165168 name,
166169 description,
@@ -182,14 +185,14 @@ async function main(): Promise<void> {
182185 license,
183186 main : `dist/${ name } .js` ,
184187 scripts : {
185- tslint : "tslint -p tsconfig.json './ src/**/*.ts'" ,
188+ eslint : "eslint ' src/**/*.ts'" ,
186189 typecheck : 'tsc -p tsconfig.json' ,
187190 build : `parcel build --out-file dist/${ name } .js src/${ name } .ts` ,
188191 'symlink-package' : 'mkdirp dist && lnfs ./package.json ./dist/package.json' ,
189- serve : `npm run symlink-package && parcel serve --no-hmr --out-file dist/${ name } .js src/${ name } .ts` ,
192+ serve : `yarn run symlink-package && parcel serve --no-hmr --out-file dist/${ name } .js src/${ name } .ts` ,
190193 'watch:typecheck' : 'tsc -p tsconfig.json -w' ,
191194 'watch:build' : 'tsc -p tsconfig.dist.json -w' ,
192- 'sourcegraph:prepublish' : 'npm run typecheck && npm run build' ,
195+ 'sourcegraph:prepublish' : 'yarn run typecheck && yarn run build' ,
193196 } ,
194197 browserslist : [
195198 'last 1 Chrome versions' ,
@@ -234,15 +237,15 @@ async function main(): Promise<void> {
234237
235238 console . log ( '📦 Installing dependencies' )
236239 await exec (
237- 'npm ' ,
240+ 'yarn ' ,
238241 [
239- 'install ' ,
240- '--save- dev' ,
242+ 'add ' ,
243+ '--dev' ,
241244 'sourcegraph' ,
242245 'typescript' ,
243246 'parcel-bundler' ,
244247 'tslint' ,
245- '@sourcegraph/tslint -config' ,
248+ '@sourcegraph/eslint -config' ,
246249 '@sourcegraph/tsconfig' ,
247250 'lnfs-cli' ,
248251 'mkdirp' ,
0 commit comments