Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make linting stricter and fix linting #106

Merged
merged 10 commits into from
May 13, 2021
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ root = true
[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
hawken93 marked this conversation as resolved.
Show resolved Hide resolved
end_of_line = lf
84 changes: 74 additions & 10 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,90 @@
module.exports = {
root: true,
plugins: ['@typescript-eslint', 'promise', 'import', 'jsdoc'],
env: {
node: true,
browser: true,
es6: true,
browser: true
node: true
},
extends: [
'eslint:recommended',
'plugin:promise/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:jsdoc/recommended',
'plugin:json/recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
'plugin:prettier/recommended',
'plugin:promise/recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
'prettier'
'plugin:import/typescript'
],
plugins: ['prettier', 'promise', 'import', 'jsdoc'],
rules: {
'@typescript-eslint/explicit-function-return-type': 'error',
'@typescript-eslint/no-explicit-any': 'warn',
'import/newline-after-import': 'error',
'import/order': 'error'
'import/order': 'error',
'jsdoc/require-hyphen-before-param-description': 'error',
'jsdoc/require-description': 'warn',
'jsdoc/require-param-description': 'warn',
'jsdoc/require-jsdoc': 'error',
//TypeScript and IntelliSense already provides us information about the function typings while hovering and
// eslint-jsdoc doesn't detect a mismatch between what's declared in the function and what's declared in
// JSDOC.
'jsdoc/require-param-type': 'off',
'jsdoc/require-returns-type': 'off',
'jsdoc/check-indentation': 'error',
'jsdoc/check-syntax': 'error',
'jsdoc/check-param-names': 'error',
'jsdoc/check-property-names': 'error',
'jsdoc/check-tag-names': 'error',
'jsdoc/no-types': 'error',
'jsdoc/valid-types': 'off',
'promise/no-nesting': 'error',
'promise/no-return-in-finally': 'error',
'promise/prefer-await-to-callbacks': 'error',
'promise/prefer-await-to-then': 'error',
'@typescript-eslint/explicit-function-return-type': 'error',
'@typescript-eslint/prefer-ts-expect-error': 'error',
'@typescript-eslint/no-unused-vars': 'error',
'prefer-arrow-callback': 'error',
'prefer-template': 'error',
curly: 'error',
'padding-line-between-statements': [
'error',
// Always require blank lines after directives (like 'use-strict'), except between directives
{ blankLine: 'always', prev: 'directive', next: '*' },
{ blankLine: 'any', prev: 'directive', next: 'directive' },
// Always require blank lines after import, except between imports
{ blankLine: 'always', prev: 'import', next: '*' },
{ blankLine: 'any', prev: 'import', next: 'import' },
// Always require blank lines before and after every sequence of variable declarations and export
{
blankLine: 'always',
prev: '*',
next: ['const', 'let', 'var', 'export']
},
{
blankLine: 'always',
prev: ['const', 'let', 'var', 'export'],
next: '*'
},
{
blankLine: 'any',
prev: ['const', 'let', 'var', 'export'],
next: ['const', 'let', 'var', 'export']
},
// Always require blank lines before and after class declaration, if, do/while, switch, try
{
blankLine: 'always',
prev: '*',
next: ['if', 'class', 'for', 'do', 'while', 'switch', 'try']
},
{
blankLine: 'always',
prev: ['if', 'class', 'for', 'do', 'while', 'switch', 'try'],
next: '*'
},
// Always require blank lines before return statements
{ blankLine: 'always', prev: '*', next: 'return' }
]
},
overrides: [
{
Expand Down
54 changes: 27 additions & 27 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
version: 2
updates:
# Fetch and update latest `npm` packages
- package-ecosystem: npm
directory: '/'
schedule:
interval: daily
time: '00:00'
open-pull-requests-limit: 10
reviewers:
- YouKnowBlom
- ferferga
- hawken93
assignees:
- YouKnowBlom
- ferferga
- hawken93
commit-message:
prefix: fix
prefix-development: chore
include: scope
# Fetch and update latest `npm` packages
- package-ecosystem: npm
directory: '/'
schedule:
interval: daily
time: '00:00'
open-pull-requests-limit: 10
reviewers:
- YouKnowBlom
- ferferga
- hawken93
assignees:
- YouKnowBlom
- ferferga
- hawken93
commit-message:
prefix: fix
prefix-development: chore
include: scope

- package-ecosystem: github-actions
directory: '/'
schedule:
interval: daily
time: '00:00'
open-pull-requests-limit: 10
commit-message:
prefix: actions
- package-ecosystem: github-actions
directory: '/'
schedule:
interval: daily
time: '00:00'
open-pull-requests-limit: 10
commit-message:
prefix: actions
74 changes: 37 additions & 37 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
name: Lint

on:
push:
branches:
- master
pull_request:
branches:
- master
push:
branches:
- master
pull_request:
branches:
- master

jobs:
lint:
name: Lint TS and CSS
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2.3.4

- name: Setup node env
uses: actions/setup-node@v2.1.5
with:
node-version: 14

- name: Get npm cache directory path
id: npm-cache-dir-path
run: echo "::set-output name=dir::$(npm config get cache)"

- name: Cache node_modules
uses: actions/cache@v2.1.5
id: npm-cache
with:
path: ${{ steps.npm-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Install dependencies
run: npm ci --no-audit

- name: Run ESLint
run: npm run lint
lint:
name: Lint TS and CSS
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2.3.4

- name: Setup node env
uses: actions/setup-node@v2.1.5
with:
node-version: 14

- name: Get npm cache directory path
id: npm-cache-dir-path
run: echo "::set-output name=dir::$(npm config get cache)"

- name: Cache node_modules
uses: actions/cache@v2.1.5
id: npm-cache
with:
path: ${{ steps.npm-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Install dependencies
run: npm ci --no-audit

- name: Run ESLint
run: npm run lint
74 changes: 37 additions & 37 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
name: Test

on:
push:
branches:
- master
pull_request:
branches:
- master
push:
branches:
- master
pull_request:
branches:
- master

jobs:
jest:
name: Jest
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2.3.4

- name: Setup node env
uses: actions/setup-node@v2.1.5
with:
node-version: 14

- name: Get npm cache directory path
id: npm-cache-dir-path
run: echo "::set-output name=dir::$(npm config get cache)"

- name: Cache node_modules
uses: actions/cache@v2.1.5
id: npm-cache
with:
path: ${{ steps.npm-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Install dependencies
run: npm ci --no-audit

- name: Run tests
run: npm run test
jest:
name: Jest
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2.3.4

- name: Setup node env
uses: actions/setup-node@v2.1.5
with:
node-version: 14

- name: Get npm cache directory path
id: npm-cache-dir-path
run: echo "::set-output name=dir::$(npm config get cache)"

- name: Cache node_modules
uses: actions/cache@v2.1.5
id: npm-cache
with:
path: ${{ steps.npm-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Install dependencies
run: npm ci --no-audit

- name: Run tests
run: npm run test
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# ide
.idea
.vscode
tags

# npm/yarn
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
dist/
node_modules/
src/api/generated/
package-lock.json

LICENSE.md
6 changes: 3 additions & 3 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"singleQuote": true,
"trailingComma": "none",
"semi": true,
"tabWidth": 4
"singleQuote": true,
"tabWidth": 4,
"trailingComma": "none"
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"editor.formatOnSave": true
}
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ The development environment is setup with editorconfig. Code style is enforced b

### Environment variables

| name | required | description | default if not set |
| ------------- | -------- | ---------------------------------------------------------- | ------------------ |
| name | required | description | default if not set |
| ------------- | -------- | --------------------------------------------------------- | ------------------ |
| RECEIVER_PORT | No | The port used for the dev server when `npm start` is used | 9000 |

### Building/Using
Expand Down
3 changes: 3 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['@commitlint/config-conventional']
};
Loading