Skip to content

Commit

Permalink
Merge pull request #106 from jellyfin/lint-dependabot
Browse files Browse the repository at this point in the history
Make linting stricter and fix linting
  • Loading branch information
ferferga authored May 13, 2021
2 parents 0c01596 + 27ff1fe commit e450fa8
Show file tree
Hide file tree
Showing 29 changed files with 2,864 additions and 1,077 deletions.
6 changes: 3 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
end_of_line = lf
trim_trailing_whitespace = true
108 changes: 89 additions & 19 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,112 @@
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'
],
rules: {
'@typescript-eslint/explicit-function-return-type': 'error',
'@typescript-eslint/no-explicit-any': 'warn',
'import/newline-after-import': 'error',
'import/order': 'error'
},
overrides: [
{
files: ['.js', '.ts'],
env: {
node: false,
browser: true,
es6: true
es6: true,
node: false
},
files: ['.js', '.ts'],
globals: {
$scope: 'writable',
cast: 'readonly',
PRODUCTION: 'readonly',
$scope: 'writable'
PRODUCTION: 'readonly'
}
}
],
plugins: ['prettier', 'promise', 'import', 'jsdoc'],
root: true,
rules: {
'@typescript-eslint/explicit-function-return-type': 'error',
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/prefer-ts-expect-error': 'error',
curly: 'error',
'import/newline-after-import': 'error',
'import/order': 'error',
'jsdoc/check-indentation': 'error',
'jsdoc/check-param-names': 'error',
'jsdoc/check-property-names': 'error',
'jsdoc/check-syntax': 'error',
'jsdoc/check-tag-names': 'error',
'jsdoc/no-types': 'error',
'jsdoc/require-description': 'warn',
'jsdoc/require-hyphen-before-param-description': 'error',
'jsdoc/require-jsdoc': 'error',
'jsdoc/require-param-description': 'warn',
//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/valid-types': 'off',
'padding-line-between-statements': [
'error',
// Always require blank lines after directives (like 'use-strict'), except between directives
{ blankLine: 'always', next: '*', prev: 'directive' },
{ blankLine: 'any', next: 'directive', prev: 'directive' },
// Always require blank lines after import, except between imports
{ blankLine: 'always', next: '*', prev: 'import' },
{ blankLine: 'any', next: 'import', prev: 'import' },
// Always require blank lines before and after every sequence of variable declarations and export
{
blankLine: 'always',
next: ['const', 'let', 'var', 'export'],
prev: '*'
},
{
blankLine: 'always',
next: '*',
prev: ['const', 'let', 'var', 'export']
},
{
blankLine: 'any',
next: ['const', 'let', 'var', 'export'],
prev: ['const', 'let', 'var', 'export']
},
// Always require blank lines before and after class declaration, if, do/while, switch, try
{
blankLine: 'always',
next: ['if', 'class', 'for', 'do', 'while', 'switch', 'try'],
prev: '*'
},
{
blankLine: 'always',
next: '*',
prev: ['if', 'class', 'for', 'do', 'while', 'switch', 'try']
},
// Always require blank lines before return statements
{ blankLine: 'always', next: 'return', prev: '*' }
],
'prefer-arrow-callback': 'error',
'prefer-template': 'error',
'promise/no-nesting': 'error',
'promise/no-return-in-finally': 'error',
'promise/prefer-await-to-callbacks': 'error',
'promise/prefer-await-to-then': 'error',
'sort-keys': [
'error',
'asc',
{ caseSensitive: false, minKeys: 2, natural: true }
],
'sort-vars': 'error'
},
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx']
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
}
Loading

0 comments on commit e450fa8

Please sign in to comment.