Skip to content

Commit

Permalink
eslint and prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
santanacostamarco committed Apr 27, 2020
1 parent 86adcf1 commit e0fec3d
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 24 deletions.
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
root = true

[*]
end_of_line = lf
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
/*.js
dist
64 changes: 43 additions & 21 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,46 @@
{
"env": {
"es6": true,
"node": true
},
"extends": [
"airbnb-base",
"plugin:@typescript-eslint/recomended"
"env": {
"es6": true,
"node": true
},
"extends": [
"airbnb-base",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
"prettier/@typescript-eslint"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
"prettier"
],
"rules": {
"no-console": [
"error",
{
"allow": ["info"]
}
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"prettier/prettier": "error",
"import/extensions": [
"error",
"ignorePackages",
{
"ts": "never"
}
]
},
"settings": {
"import/resolver": {
"typescript": {}
}
}
}
}
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,19 @@
"author": "Marco Santana <[email protected]>",
"license": "MIT",
"dependencies": {
"@types/express": "^4.17.6",
"express": "^4.17.1"
},
"devDependencies": {
"@types/express": "^4.17.6",
"@typescript-eslint/eslint-plugin": "^2.29.0",
"@typescript-eslint/parser": "^2.29.0",
"eslint": "^6.8.0",
"eslint-config-airbnb-base": "^14.1.0",
"eslint-config-prettier": "^6.11.0",
"eslint-import-resolver-typescript": "^2.0.0",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-prettier": "^3.1.3",
"prettier": "^2.0.5",
"ts-node-dev": "^1.0.0-pre.44",
"typescript": "^3.8.3"
}
Expand Down
5 changes: 5 additions & 0 deletions prettier.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
singleQuote: true,
trailingComma: 'all',
arrowParams: 'avoid',
};
9 changes: 9 additions & 0 deletions src/routes/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Router } from 'express';

const routes = Router();

routes.get('/hello', (request, response) => {
return response.json({ message: 'hello, world!' });
});

export default routes;
9 changes: 7 additions & 2 deletions src/server.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import express from 'express';
import router from './routes';

const app = express();

app.get('/', (request, response) =>
response.send('Hello, typescript!'));
app.use(express.json());
app.use(router);

app.get('/', (request, response) => {
return response.send('Hello, typescript!');
});

app.listen(3333);

0 comments on commit e0fec3d

Please sign in to comment.