Skip to content

Instantly share code, notes, and snippets.

@madhums madhums/README.md
Last active Feb 20, 2019

Embed
What would you like to do?
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
You can’t perform that action at this time.