1.1.2 • Published 1 year ago
eslint-config-oy v1.1.2
eslint-config-oy
Shared ESLint config for my projects.
(Lints both JavaScript & TypeScript projects.)
Installation
$ npm install --save-dev eslint-config-oyUsage
.eslintrc.json in TypeScript project:
{
"extends": [
"eslint-config-oy/ts"
]
}.eslintrc.json in JavaScript project:
{
"extends": [
"eslint-config-oy"
]
}Evironment Set Up
- Install
eslintextension for VSCode. Add files below in the project's
.vscodedirectory and paste related contents:.vscode/extensions.json:{ "recommendations": [ "dbaeumer.vscode-eslint" ] }.vscode/tasks.json:{ "version": "2.0.0", "tasks": [ { "type": "npm", "script": "lint", "problemMatcher": ["$eslint-stylish"], "label": "npm: lint", "detail": "" } ] }.vscode/settings.json:{ "eslint.validate": [ "typescript", "typescriptreact" ] }
Contributing
index.jsis eslint config for JavaScript projects.ts.jsis eslint config for TypeScript projects; and extends fromindex.js.If
@typescript-eslinthas an override rule of an eslint rule; first make sure you turn off the eslint rule ints.js.{ quotes: "off", '@typescript-eslint/quotes': [ 'error', 'single', { avoidEscape: true, allowTemplateLiterals: true } ], }If a rule works the same way for both JavaScript and TypeScript, add the rule's value (configuration) in
_common.jsand reference in bothindex.jsandts.js.// _common.js { QUOTES: [ 'error', 'single', { avoidEscape: true, allowTemplateLiterals: true } ], // ... } // index.js { quotes: common.QUOTES, // ... } // ts.js { quotes: 'off', '@typescript-eslint/quotes': common.QUOTES, // ... }