Skip to content

Instantly share code, notes, and snippets.

@madhums
Last active February 20, 2019 14:51
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 madhums/098653f10a4692a887598787f0c90869 to your computer and use it in GitHub Desktop.
Save madhums/098653f10a4692a887598787f0c90869 to your computer and use it in GitHub Desktop.
tslint prettier and atom

Tslint with Prettier on Atom

Install linter, linter-ui-default and linter-tslint packages on Atom.

Run below to detect errors:

$ npx tslint --project tsconfig.json --config tslint.json

and to fix

$ npx tslint --project tsconfig.json --config tslint.json --fix
// src/index.ts
interface Person {
firstName: string;
lastName: string;
}
function hello(person: Person) {
console.log('hello ', person.firstName + ' ' + person.lastName);
}
const user = { firstName: 'marc', lastName: 'dom', age: 30 };
hello(user);
{
"name": "learn-typescript",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo 'Error: no test specified'",
"compile": "tsc && node build/index.js",
"dev": "nodemon -e ts --exec 'npm run compile'"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {},
"devDependencies": {
"nodemon": "~1.18.10",
"prettier": "~1.16.4",
"tslint": "~5.12.1",
"tslint-config-prettier": "~1.18.0",
"tslint-config-semistandard": "~7.0.0",
"tslint-plugin-prettier": "~2.0.1",
"typescript": "~3.3.3"
}
}
{
"compilerOptions": {
"outDir": "./build",
"allowJs": true,
"target": "es5",
"strictNullChecks": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true
},
"include": [
"./src/**/*"
]
}
{
"defaultSeverity": "error",
"extends": [
"tslint-config-prettier",
"tslint-config-semistandard"
],
"jsRules": {},
"rules": {
"prettier": [true, {
"printWidth": 80,
"semi": true,
"jsxBracketSameLine": true,
"jsxSingleQuote": false,
"bracketSpacing": true,
"singleQuote": true,
"tabWidth": 2,
"useTabs": false,
"parser": "typescript"
}],
"space-before-function-paren": false
},
"rulesDirectory": [
"tslint-plugin-prettier"
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment