diff --git a/lib/snippets/node/Assets.ts b/lib/snippets/node/Assets.ts index f92ac7a..3082501 100644 --- a/lib/snippets/node/Assets.ts +++ b/lib/snippets/node/Assets.ts @@ -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 }; diff --git a/lib/snippets/node/index.ts b/lib/snippets/node/index.ts index 23231d9..d4f0865 100644 --- a/lib/snippets/node/index.ts +++ b/lib/snippets/node/index.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 { @@ -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 (