add eslintrc for ts
This commit is contained in:
parent
7a563862af
commit
3ea7163e17
@ -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/
|
const gitignore = `/node_modules/
|
||||||
/dist/
|
/dist/
|
||||||
/.nyc_output/
|
/.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 { Snippet } from '../../Snippet';
|
||||||
import { apply_template, modify_json, run_command } from '../../Helper';
|
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 {
|
export default class Node implements Snippet {
|
||||||
public async start (): Promise<void> {
|
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 (eslintrc, path.join (folder, '.eslintrc.js'));
|
||||||
await apply_template (npmrc, path.join (folder, '.npmrc'));
|
await apply_template (npmrc, path.join (folder, '.npmrc'));
|
||||||
await apply_template (gitignore, path.join (folder, '.gitignore'));
|
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 (tsconfig, path.join (folder, 'tsconfig.json'));
|
||||||
|
await apply_template (
|
||||||
|
eslintrc_ts,
|
||||||
|
path.join (folder, 'lib', '.eslintrc.js')
|
||||||
|
);
|
||||||
|
}
|
||||||
run_command ('git init', folder);
|
run_command ('git init', folder);
|
||||||
run_command ('yarn init -y', folder);
|
run_command ('yarn init -y', folder);
|
||||||
run_command (
|
run_command (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user