Skip to content

Instantly share code, notes, and snippets.

@dbhagen
Forked from lewebsimple/setup-typescript.sh
Created October 18, 2023 16:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dbhagen/07c5060e4bc64023a8f1fa15283c07bc to your computer and use it in GitHub Desktop.
Save dbhagen/07c5060e4bc64023a8f1fa15283c07bc to your computer and use it in GitHub Desktop.
TypeScript / ESLint / Prettier / Vue 3
#!/bin/bash
yarn add -D @typescript-eslint/eslint-plugin \
typescript ts-node-dev \
@typescript-eslint/parser @typescript-eslint/eslint-plugin eslint eslint-config-prettier eslint-plugin-prettier eslint-plugin-vue prettier
cat > .eslintrc.js <<EOF
module.exports = {
root: true,
env: {
node: true,
},
parser: "vue-eslint-parser",
parserOptions: {
parser: "@typescript-eslint/parser",
ecmaVersion: 2020,
sourceType: "module",
},
extends: [
"plugin:@typescript-eslint/recommended",
"eslint:recommended",
"prettier/@typescript-eslint",
"plugin:prettier/recommended",
"plugin:vue/vue3-recommended",
//"plugin:vue/recommended",
"prettier/vue",
],
plugins: ["prettier", "@typescript-eslint"],
rules: {
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars-experimental": "error",
},
"ignorePatterns": ["dist"],
};
EOF
cat > .prettierrc.js <<EOF
module.exports = {
printWidth: 120,
semi: true,
tabWidth: 2,
trailingComma: "all"
};
EOF
cat > tsconfig.json <<EOF
{
"compilerOptions": {
"target": "ES5",
"module": "CommonJS",
"lib": [
"DOM",
"ES2020"
],
"outDir": "dist",
"esModuleInterop": true,
"sourceMap": true,
"declaration": true,
"skipLibCheck": true
}
}
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment