@futuredapp/eslint-config-typescript
v1.0.2
Published
Futured App eslint config for Typescript.
Downloads
13
Readme
Eslint setup
Install packages
npm install eslint prettier eslint-config-prettier @typescript-eslint/parser @typescript-eslint/eslint-plugin --save-dev
or
yarn add eslint prettier eslint-config-prettier @typescript-eslint/parser @typescript-eslint/eslint-plugin --dev
Eslint config file
Create .eslintrc.js
file with content:
const { resolve } = require('path')
module.exports = {
parserOptions: {
parser: '@typescript-eslint/parser',
project: resolve(__dirname, './tsconfig.json'),
tsconfigRootDir: __dirname,
ecmaVersion: 12,
sourceType: 'module'
},
env: {
browser: false,
es2021: true,
node: true
},
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'prettier',
'@futuredapp/eslint-config-typescript'
],
plugins: [
'@typescript-eslint'
],
globals: {
process: true
},
ignorePatterns: ['.eslintrc.js']
}
Prettier config file
Create .prettierrc
with content:
{
"singleQuote": true,
"semi": false,
"printWidth": 120,
"useTabs": false,
"trailingComma": "all"
}
Typescript config file
Create or update existing tsconfig.json
with content:
{
"compilerOptions": {
"target": "ES2020", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
"allowJs": false, /* Allow javascript files to be compiled. */
"outDir": "./dist", /* Redirect output structure to the directory. */
"strict": true, /* Enable all strict type-checking options. */
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
"skipLibCheck": true, /* Skip type checking of declaration files. */
"forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */
"sourceMap": true
},
"include": ["./src/**/*", "./index.ts"],
"exclude": ["node_modules"]
}