Skip to content

Commit

Permalink
style: Tslint replaced by eslint, code fixed to meet code style requi…
Browse files Browse the repository at this point in the history
…rements
  • Loading branch information
Sergii Kovalev committed Nov 4, 2020
1 parent abbc8af commit ec7e92f
Show file tree
Hide file tree
Showing 10 changed files with 1,528 additions and 194 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Expand Up @@ -8,6 +8,9 @@ indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.yml]
indent_size = 2

Expand Down
15 changes: 15 additions & 0 deletions .eslintignore
@@ -0,0 +1,15 @@
# package directories
node_modules
#dist is only for the package
dist
#ignore npm pack output
serverless-iam-roles-per-function-*.tgz
#ignore coverage dir
coverage
.nyc_output
npm-debug.log
*.txt
# JetBrains IDE
.idea
# serverless
.serverless
89 changes: 89 additions & 0 deletions .eslintrc.js
@@ -0,0 +1,89 @@
// @see https://eslint.org/docs/user-guide/configuring#configuring-rules
const OFF = 0;
const WARN = 1;
const ERROR = 2;

module.exports = {
root: true,
parser: '@typescript-eslint/parser',
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
],
env: {
node: true,
mocha: true,
},
plugins: [
'import',
],
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
},
rules: {
'@typescript-eslint/no-explicit-any': OFF,
'@typescript-eslint/explicit-module-boundary-types': OFF,
'arrow-body-style': [ERROR, 'as-needed'],
'comma-dangle': [ERROR, 'always-multiline'],
'import/imports-first': ERROR,
'import/newline-after-import': ERROR,
'import/no-named-as-default': ERROR,
'import/no-unresolved': [ERROR, { commonjs: true, amd: true }],
'import/no-cycle': ['error', { maxDepth: 9999 }],
indent: [ERROR, 2, { SwitchCase: 1 }],
'max-len': [ERROR, 120],
'newline-per-chained-call': ERROR,
'no-confusing-arrow': ERROR,
'no-unused-vars': [ERROR, { argsIgnorePattern: '^_' }],
'no-use-before-define': ERROR,
'require-yield': ERROR,
'function-call-argument-newline': [ERROR, 'consistent'],
'linebreak-style': OFF,
'no-trailing-spaces': ERROR,
'no-cond-assign': [ERROR, 'except-parens'],
'no-unused-expressions': [ERROR, { allowShortCircuit: true, allowTernary: true }],
'sort-imports': [ERROR, {
ignoreCase: false,
ignoreDeclarationSort: true,
ignoreMemberSort: false,
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
}],
eqeqeq: [ERROR, 'always', { null: 'ignore' }],
quotes: [ERROR, 'single'],
// JSDoc Requirements
'require-jsdoc': [WARN, {
require: {
FunctionDeclaration: true,
MethodDefinition: true,
ClassDeclaration: false,
},
}],
'valid-jsdoc': [ERROR, {
requireReturn: true,
requireReturnDescription: false,
requireParamDescription: false,
requireParamType: true,
requireReturnType: false,
preferType: {
Boolean: 'boolean', Number: 'number', object: 'Object', String: 'string',
},
}],
},
settings: {
'import/resolver': {
'node': {
'extensions': ['.js', '.jsx', '.ts', '.tsx'],
},
},
},
overrides: [
{
files: ['*.test.ts'],
rules: {
'@typescript-eslint/no-var-requires': OFF,
},
},
],
};
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -20,5 +20,6 @@ before_install:
install:
- travis_retry npm install
- npm install --no-save --ignore-scripts `npx npm-get-version serverless@$SERVERLESS_VERSION`
- npm run lint

after_success: test -z "$COV_PUB" || npm run coverage

0 comments on commit ec7e92f

Please sign in to comment.