add eslintrc for ts
This commit is contained in:
		| @@ -17,6 +17,25 @@ const eslintrc = `module.exports = { | ||||
| } | ||||
| `; | ||||
|  | ||||
| const eslintrc_ts = `module.exports = { | ||||
|   env: { | ||||
|     commonjs: true, | ||||
|     es6: true, | ||||
|     node: true | ||||
|   }, | ||||
|   extends: [ | ||||
|     '@scode/eslint-config-ts' | ||||
|   ], | ||||
|   globals: { | ||||
|     Atomics: 'readonly', | ||||
|     SharedArrayBuffer: 'readonly' | ||||
|   }, | ||||
|   parserOptions: { | ||||
|     ecmaVersion: 2018 | ||||
|   } | ||||
| } | ||||
| `; | ||||
|  | ||||
| const gitignore = `/node_modules/ | ||||
| /dist/ | ||||
| /.nyc_output/ | ||||
| @@ -39,4 +58,4 @@ const tsconfig = `{ | ||||
| } | ||||
| `; | ||||
|  | ||||
| export { eslintrc, gitignore, npmrc, tsconfig }; | ||||
| export { eslintrc, gitignore, npmrc, tsconfig, eslintrc_ts }; | ||||
|   | ||||
| @@ -10,7 +10,7 @@ import { Input } from 'enquirer'; | ||||
| import { Snippet } from '../../Snippet'; | ||||
| import { apply_template, modify_json, run_command } from '../../Helper'; | ||||
|  | ||||
| import { eslintrc, gitignore, npmrc, tsconfig } from './Assets'; | ||||
| import { eslintrc, gitignore, npmrc, tsconfig, eslintrc_ts } from './Assets'; | ||||
|  | ||||
| export default class Node implements Snippet { | ||||
|   public async start (): Promise<void> { | ||||
| @@ -28,9 +28,13 @@ export default class Node implements Snippet { | ||||
|     await apply_template (eslintrc, path.join (folder, '.eslintrc.js')); | ||||
|     await apply_template (npmrc, path.join (folder, '.npmrc')); | ||||
|     await apply_template (gitignore, path.join (folder, '.gitignore')); | ||||
|     if (use_ts) | ||||
|     if (use_ts) { | ||||
|       await apply_template (tsconfig, path.join (folder, 'tsconfig.json')); | ||||
|  | ||||
|       await apply_template ( | ||||
|         eslintrc_ts, | ||||
|         path.join (folder, 'lib', '.eslintrc.js') | ||||
|       ); | ||||
|     } | ||||
|     run_command ('git init', folder); | ||||
|     run_command ('yarn init -y', folder); | ||||
|     run_command ( | ||||
|   | ||||
		Reference in New Issue
	
	Block a user