Skip to content

Commit

Permalink
Unify eslint & tsconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
kaisalmen committed Nov 7, 2023
1 parent 9064613 commit ede6c7f
Show file tree
Hide file tree
Showing 13 changed files with 176 additions and 186 deletions.
114 changes: 108 additions & 6 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,116 @@
/** @type {import('eslint').Linter.Config} */
module.exports = {
extends: ['./configs/.eslintrc.js'],
env: {
browser: true,
node: true
},
extends: [
'prettier'
],
parser: '@typescript-eslint/parser',
ignorePatterns: [
'**/{node_modules,lib}',
// "**/src/**/*.spec.?(ts|tsx)",
// "**/src/utils/test-helper.ts",
"**/sprotty-local-template/**/*"
'**/sprotty-local-template/**/*'
],
parserOptions: {
tsconfigRootDir: __dirname,
project: 'tsconfig.eslint.json'
project: './tsconfig.json'
},
plugins: [
'eslint-plugin-no-null',
'@typescript-eslint',
'header'
],
rules: {
'@typescript-eslint/indent': 'off',
'@typescript-eslint/naming-convention': 'off',
'@typescript-eslint/no-dynamic-delete': 'error',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-misused-new': 'error',
'@typescript-eslint/no-shadow': [
'warn',
{
'hoist': 'all'
}
],
'@typescript-eslint/no-unused-expressions': 'off',
'@typescript-eslint/semi': [
'error',
'always'
],
'@typescript-eslint/type-annotation-spacing': 'warn',
'header/header': ['error', 'block', [{'pattern': '[\n\r]+ \\* Copyright \\([cC]\\) \\d{4}(-\\d{4})? .*[\n\r]+'}]],
'brace-style': [
'warn',
'1tbs',
{ 'allowSingleLine': true }
],
'comma-dangle': ['warn', {
'arrays': 'only-multiline',
'objects': 'only-multiline',
}],
'constructor-super': 'error',
'curly': 'off',
'eol-last': 'warn',
'eqeqeq': [
'warn',
'smart'
],
'guard-for-in': 'warn',
'id-blacklist': 'off',
'id-match': 'off',
'keyword-spacing': ['warn', { 'before': true }],
'max-len': [
'warn',
{
'code': 180
}
],
'no-prototype-builtins': 'error',
'no-caller': 'error',
'no-console': 'off',
'no-debugger': 'warn',
'no-eval': 'error',
'no-fallthrough': 'warn',
'no-invalid-this': 'warn',
'no-new-wrappers': 'warn',
'no-null/no-null': 'off',
'no-redeclare': 'off',
'no-restricted-imports': [
'error',
'..',
'../index',
'../..',
'../../index'
],
'no-return-await': 'warn',
'no-sequences': 'error',
'no-throw-literal': 'error',
'no-trailing-spaces': 'warn',
'no-underscore-dangle': 'off',
'no-unsafe-finally': 'error',
'no-var': 'error',
'prefer-const': [
'warn',
{
'destructuring': 'all'
}
],
'prefer-object-spread': 'warn',
'radix': 'warn',
'spaced-comment': [
'warn',
'always',
{
'markers': [
'/'
],
'exceptions': [
'*'
]
}
],
'space-infix-ops': 'warn',
'use-isnan': 'warn'
}
};
};
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,7 @@ jobs:
node-version: '16'
- name: Build
run: yarn
- name: Lint
run: yarn lint
- name: Test
run: yarn test
111 changes: 0 additions & 111 deletions configs/.eslintrc.js

This file was deleted.

27 changes: 0 additions & 27 deletions configs/base.tsconfig.json

This file was deleted.

8 changes: 5 additions & 3 deletions examples/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"extends": "../configs/base.tsconfig.json",
"extends": "../tsconfig.json",
"compilerOptions": {
"types": [
"reflect-metadata", "webpack-env"
"reflect-metadata",
"webpack-env"
],
"declaration": false,
"declarationMap": false
Expand All @@ -11,6 +12,7 @@
"./server/**/*.ts"
],
"exclude": [
"**/*.spec.ts", "**/*.spec.tsx"
"**/*.spec.ts",
"**/*.spec.tsx"
]
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"clean": "lerna run clean",
"build": "lerna run build",
"lint": "eslint {**/src/**/*.ts,**/src/**/*.tsx}",
"lint:fix": "eslint {**/src/**/*.ts,\"**/src/**/!(*.spec.ts*|test-helper.ts)\",**/src/**/*.tsx} --fix",
"lint:fix": "eslint {**/src/**/*.ts,**/src/**/*.tsx} --fix",
"test": "vitest run",
"coverage": "vitest run --coverage",
"publish:prepare": "lerna version --ignore-scripts --yes --no-push",
Expand Down
2 changes: 1 addition & 1 deletion packages/generator-sprotty/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../configs/base.tsconfig.json",
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "app"
},
Expand Down
27 changes: 14 additions & 13 deletions packages/sprotty-elk/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{
"extends": "../../configs/base.tsconfig.json",
"compilerOptions": {
"outDir": "lib",
"types": [
"node"
]
},
"include": [
"src"
],
"exclude": [
"**/*.spec.ts", "**/*.spec.tsx"
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "lib",
"types": [
"node"
]
}
},
"include": [
"src"
],
"exclude": [
"**/*.spec.ts",
"**/*.spec.tsx"
]
}
5 changes: 3 additions & 2 deletions packages/sprotty-protocol/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"extends": "../../configs/base.tsconfig.json",
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "lib"
},
"include": [
"src"
],
"exclude": [
"**/*.spec.ts", "**/*.spec.tsx"
"**/*.spec.ts",
"**/*.spec.tsx"
]
}
6 changes: 4 additions & 2 deletions packages/sprotty/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{
"extends": "../../configs/base.tsconfig.json",
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "lib"
},
"include": [
"src"
],
"exclude": [
"**/*.spec.ts", "**/*.spec.tsx", "src/utils/test-helper.ts"
"**/*.spec.ts",
"**/*.spec.tsx",
"src/utils/test-helper.ts"
]
}
15 changes: 0 additions & 15 deletions tsconfig.eslint.json

This file was deleted.

Loading

0 comments on commit ede6c7f

Please sign in to comment.