Skip to content

Commit

Permalink
Enable eslint and prettier check, reformat all code (#297)
Browse files Browse the repository at this point in the history
* #278 Enable eslint and prettier check, reformat all code

Signed-off-by: Yevhen Vydolob <yvydolob@redhat.com>

* make prettier optional dependency

Signed-off-by: Yevhen Vydolob <yvydolob@redhat.com>

* Fix formatting

Signed-off-by: Yevhen Vydolob <yvydolob@redhat.com>

* Set 'printWidth' to 130

Signed-off-by: Yevhen Vydolob <yvydolob@redhat.com>

* return back  'es6: true'

Signed-off-by: Yevhen Vydolob <yvydolob@redhat.com>

* Use 'eslint-plugin-prettier' to run prettier chack on lint

Signed-off-by: Yevhen Vydolob <yvydolob@redhat.com>

* add extension recommendation

Signed-off-by: Yevhen Vydolob <yvydolob@redhat.com>
  • Loading branch information
evidolob committed Aug 12, 2020
1 parent 82b398f commit a1fb29f
Show file tree
Hide file tree
Showing 67 changed files with 10,751 additions and 10,110 deletions.
4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Tab indentation
[*]
indent_style = space
indent_size = 4
indent_size = 2
trim_trailing_whitespace = false

[{.travis.yml,npm-shrinkwrap.json,package.json}]
indent_style = space
indent_size = 2
indent_size = 2
106 changes: 26 additions & 80 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,82 +1,28 @@
/*
👋 Hi! This file was autogenerated by tslint-to-eslint-config.
https://github.com/typescript-eslint/tslint-to-eslint-config
It represents the closest reasonable ESLint configuration to this
project's original TSLint configuration.
We recommend eventually switching this configuration to extend from
the recommended rulesets in typescript-eslint.
https://github.com/typescript-eslint/tslint-to-eslint-config/blob/master/docs/FAQs.md
Happy linting! 💖
*/
module.exports = {
'env': {
'es6': true,
'node': true
},
'parser': '@typescript-eslint/parser',
'parserOptions': {
'sourceType': 'module'
},
'plugins': [
'@typescript-eslint',
],
'rules': {
'@typescript-eslint/consistent-type-definitions': 'error',
'@typescript-eslint/indent': 'error',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unused-expressions': 'error',
'@typescript-eslint/no-unused-vars': 'warn',
'@typescript-eslint/quotes': [
'error',
'single',
{
'avoidEscape': true
}
],
'@typescript-eslint/semi': [
'error',
'always'
],
'@typescript-eslint/type-annotation-spacing': 'error',
'arrow-body-style': [
'error',
'always'
],
'arrow-parens': [
'error',
'as-needed'
],
'camelcase': 'off',
'comma-dangle': 'off',
'curly': 'error',
'eol-last': 'error',
'eqeqeq': [
'error',
'smart'
],
'id-blacklist': 'off',
'id-match': 'off',
'max-len': [
'error',
{
'code': 180
}
],
'no-multiple-empty-lines': 'error',
'no-trailing-spaces': 'error',
'no-underscore-dangle': 'off',
'no-var': 'error',
'no-void': 'error',
'prefer-const': 'error',
'radix': 'off',
'space-before-function-paren': [
'error',
{
'anonymous': 'always'
}
]
}
root: true,
parser: '@typescript-eslint/parser',
env: {
node: true,
es6: true,
},
parserOptions: {
sourceType: 'module',
},
plugins: ['@typescript-eslint', 'prettier'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
],
rules: {
'prettier/prettier': 'error',
'@typescript-eslint/no-use-before-define': ['error', { functions: false, classes: false }],
'@typescript-eslint/no-unused-vars': ['warn'],
'@typescript-eslint/explicit-function-return-type': [1, { allowExpressions: true }],
'eol-last': ['error'],
'space-infix-ops': ['error', { int32Hint: false }],
'no-multi-spaces': ['error', { ignoreEOLComments: true }],
'keyword-spacing': ['error'],
},
};
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ npm-debug.log
node_modules/
npm-debug.log
.nyc_output
out/server
out/server
.DS_Store
yarn-error.log
6 changes: 6 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"arrowParens": "always",
"printWidth": 130,
"singleQuote": true,
"trailingComma": "es5"
}
18 changes: 9 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
version: ~> 1.0
language: node_js
node_js:
- '12'
- '12'
os:
- osx
- linux
- osx
- linux
before_install:
- if [ $TRAVIS_OS_NAME == "linux" ]; then export CXX="g++-4.9" CC="gcc-4.9" DISPLAY=:99.0;
sh -e /etc/init.d/xvfb start; sleep 3; fi
- yarn global add typescript
- if [ $TRAVIS_OS_NAME == "linux" ]; then export CXX="g++-4.9" CC="gcc-4.9" DISPLAY=:99.0;
sh -e /etc/init.d/xvfb start; sleep 3; fi
- yarn global add typescript
install:
- yarn install
- yarn run compile
- yarn install
- yarn run build
after_script:
- yarn run coveralls
- yarn run coveralls
deploy:
provider: npm
email: gorkem.ercan@gmail.com
Expand Down
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": ["dbaeumer.vscode-eslint"]
}
55 changes: 23 additions & 32 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,34 +1,25 @@
{
"version": "0.2.0",
"configurations": [
// An attach configuration that attaches the debugger to a running server
{
"name": "Attach to server",
"type": "node",
"request": "attach",
"port": 6009,
"sourceMaps": true,
"outFiles": [ "${workspaceRoot}/out/server/**/*.ts" ],
"protocol": "inspector",
"trace": true
},
// A launch configuration that compiles the server and runs mocha unit tests
{
"type": "node",
"request": "launch",
"name": "Launch Tests",
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
"args": [
"-u",
"tdd",
"--timeout",
"999999",
"--colors",
"-r",
"ts-node/register",
"${workspaceRoot}/test/*.test.ts"
],
"preLaunchTask": "watch typescript"
}
]
"version": "0.2.0",
"configurations": [
// An attach configuration that attaches the debugger to a running server
{
"name": "Attach to server",
"type": "node",
"request": "attach",
"port": 6009,
"sourceMaps": true,
"outFiles": ["${workspaceRoot}/out/server/**/*.ts"],
"protocol": "inspector",
"trace": true
},
// A launch configuration that compiles the server and runs mocha unit tests
{
"type": "node",
"request": "launch",
"name": "Launch Tests",
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
"args": ["-u", "tdd", "--timeout", "999999", "--colors", "-r", "ts-node/register", "${workspaceRoot}/test/*.test.ts"],
"preLaunchTask": "watch typescript"
}
]
}
44 changes: 22 additions & 22 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "watch typescript",
"type": "shell",
"command": "npm run watch",
"presentation": {
"reveal": "silent"
},
"isBackground": true,
"problemMatcher": "$tsc-watch"
},
{
"type": "npm",
"script": "lint",
"problemMatcher": ["$eslint-stylish"],
"label": "npm: lint",
"detail": "eslint -c .eslintrc.js --ext .ts src"
}
]
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "watch typescript",
"type": "shell",
"command": "npm run watch",
"presentation": {
"reveal": "silent"
},
"isBackground": true,
"problemMatcher": "$tsc-watch"
},
{
"type": "npm",
"script": "lint",
"problemMatcher": ["$eslint-stylish"],
"label": "npm: lint",
"detail": "eslint -c .eslintrc.js --ext .ts src"
}
]
}
Loading

0 comments on commit a1fb29f

Please sign in to comment.