Skip to content

Commit c10d095

Browse files
committed
shared eslint config
1 parent 332f2e9 commit c10d095

9 files changed

+40
-167
lines changed

Diff for: .eslintignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
/dist
2-
/node_modules
2+
/node_modules
3+
.eslintrc.js

Diff for: .eslintrc.js

+21-44
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,32 @@
11
module.exports = {
2-
root: true,
3-
4-
parserOptions: {
5-
parser: 'babel-eslint',
6-
sourceType: 'module'
7-
},
8-
92
env: {
10-
browser: true,
11-
mocha: true,
3+
es2021: true,
124
},
135

146
extends: [
15-
'airbnb-base',
16-
'plugin:chai-friendly/recommended',
17-
],
18-
19-
plugins: [
20-
'chai-friendly',
7+
'eslint:recommended',
8+
'plugin:@typescript-eslint/recommended',
9+
'plugin:@typescript-eslint/recommended-requiring-type-checking',
10+
'plugin:vue/essential',
11+
'prettier',
12+
'prettier/@typescript-eslint',
13+
'prettier/vue',
2114
],
2215

23-
globals: {
24-
'ga': true, // Google Analytics
25-
'cordova': true,
26-
'__statics': true,
27-
'process': true,
28-
'Capacitor': true,
29-
'chrome': true
30-
},
16+
plugins: ['@typescript-eslint', 'vue'],
3117

32-
// add your custom rules here
3318
rules: {
34-
'no-param-reassign': 'off',
35-
36-
'import/first': 'off',
37-
'import/named': 'error',
38-
'import/namespace': 'error',
39-
'import/default': 'error',
40-
'import/export': 'error',
41-
'import/extensions': 'off',
42-
'import/no-unresolved': 'off',
43-
'import/no-extraneous-dependencies': 'off',
44-
'import/prefer-default-export': 'off',
19+
'prefer-const': 'error',
4520
'prefer-promise-reject-errors': 'off',
46-
47-
// allow debugger during development only
21+
quotes: ['warn', 'single', { avoidEscape: true }],
22+
'@typescript-eslint/explicit-function-return-type': 'off',
23+
'@typescript-eslint/explicit-module-boundary-types': 'off',
24+
'@typescript-eslint/no-unsafe-member-access': 'off',
25+
'@typescript-eslint/no-unsafe-call': 'off',
26+
'@typescript-eslint/no-unsafe-assignment': 'off',
27+
'@typescript-eslint/no-var-requires': 'off',
28+
'@typescript-eslint/unbound-method': ['error', { ignoreStatic: true }],
29+
'@typescript-eslint/no-unused-vars': ['error', { ignoreRestSiblings: true }],
4830
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
49-
50-
// Max line length of 100 characters, except for lines with comments or strings
51-
'max-len': ['error', {
52-
code: 100, ignoreComments: true, ignoreTrailingComments: true, ignoreStrings: true,
53-
}],
54-
}
55-
}
31+
},
32+
};

Diff for: frontend/.eslintignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
/src-cordova
55
/.quasar
66
/node_modules
7-
/src-ssr
7+
/src-ssr
8+
.eslintrc.js

Diff for: frontend/.eslintrc.js

+4-74
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,16 @@
1-
const { resolve } = require('path');
21
module.exports = {
3-
// https://eslint.org/docs/user-guide/configuring#configuration-cascading-and-hierarchy
4-
// This option interrupts the configuration hierarchy at this file
5-
// Remove this if you have an higher level ESLint config file (it usually happens into a monorepos)
6-
root: true,
7-
8-
// https://eslint.vuejs.org/user-guide/#how-to-use-custom-parser
9-
// Must use parserOptions instead of "parser" to allow vue-eslint-parser to keep working
10-
// `parser: 'vue-eslint-parser'` is already included with any 'plugin:vue/**' config and should be omitted
2+
extends: '../.eslintrc',
113
parserOptions: {
12-
// https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser#configuration
13-
// https://github.com/TypeStrong/fork-ts-checker-webpack-plugin#eslint
14-
// Needed to make the parser take into account 'vue' files
15-
extraFileExtensions: ['.vue'],
4+
project: 'tsconfig.json',
165
parser: '@typescript-eslint/parser',
17-
project: resolve(__dirname, './tsconfig.json'),
18-
tsconfigRootDir: __dirname,
19-
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
20-
sourceType: 'module', // Allows for the use of imports
21-
},
22-
23-
env: {
24-
browser: true,
6+
extraFileExtensions: ['.vue'],
257
},
26-
27-
// Rules order is important, please avoid shuffling them
28-
extends: [
29-
// Base ESLint recommended rules
30-
// 'eslint:recommended',
31-
32-
// https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin#usage
33-
// ESLint typescript rules
34-
'plugin:@typescript-eslint/recommended',
35-
// consider disabling this class of rules if linting takes too long
36-
'plugin:@typescript-eslint/recommended-requiring-type-checking',
37-
38-
// Uncomment any of the lines below to choose desired strictness,
39-
// but leave only one uncommented!
40-
// See https://eslint.vuejs.org/rules/#available-rules
41-
'plugin:vue/essential', // Priority A: Essential (Error Prevention)
42-
// 'plugin:vue/strongly-recommended', // Priority B: Strongly Recommended (Improving Readability)
43-
// 'plugin:vue/recommended', // Priority C: Recommended (Minimizing Arbitrary Choices and Cognitive Overhead)
44-
45-
// https://github.com/prettier/eslint-config-prettier#installation
46-
// usage with Prettier, provided by 'eslint-config-prettier'.
47-
'prettier',
48-
'prettier/@typescript-eslint',
49-
'prettier/vue',
50-
],
51-
52-
plugins: [
53-
// required to apply rules which need type information
54-
'@typescript-eslint',
55-
56-
// https://eslint.vuejs.org/user-guide/#why-doesn-t-it-work-on-vue-file
57-
// required to lint *.vue files
58-
'vue',
59-
60-
// https://github.com/typescript-eslint/typescript-eslint/issues/389#issuecomment-509292674
61-
// Prettier has not been included as plugin to avoid performance impact
62-
// add it as an extension for your IDE
63-
],
64-
658
globals: {
66-
ga: true, // Google Analytics
9+
ga: true,
6710
cordova: true,
6811
__statics: true,
6912
process: true,
7013
Capacitor: true,
7114
chrome: true,
7215
},
73-
74-
// add your custom rules here
75-
rules: {
76-
'prefer-promise-reject-errors': 'off',
77-
78-
// TypeScript
79-
quotes: ['warn', 'single', { avoidEscape: true }],
80-
'@typescript-eslint/explicit-function-return-type': 'off',
81-
'@typescript-eslint/explicit-module-boundary-types': 'off',
82-
83-
// allow debugger during development only
84-
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
85-
},
8616
};

Diff for: package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
},
2222
"scripts": {
2323
"build": "lerna run build",
24-
"clean": "lerna run clean"
24+
"clean": "lerna run clean",
25+
"lint": "lerna run lint"
2526
},
2627
"husky": {
2728
"hooks": {

Diff for: umbra-js/.eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
/dist
22
/node_modules
33
/build
4+
/test
5+
.eslintrc.js
6+
test-environment.config.js

Diff for: umbra-js/.eslintrc.js

+4-45
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,7 @@
11
module.exports = {
2-
// https://eslint.org/docs/user-guide/configuring#configuration-cascading-and-hierarchy
3-
// This option interrupts the configuration hierarchy at this file
4-
// Remove this if you have an higher level ESLint config file (it usually happens into a monorepos)
5-
root: true,
6-
2+
extends: '../.eslintrc',
73
parserOptions: {
8-
parser: 'babel-eslint',
9-
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
10-
sourceType: 'module', // Allows for the use of imports
11-
},
12-
13-
env: {
14-
browser: true,
15-
},
16-
17-
// Rules order is important, please avoid shuffling them
18-
extends: [
19-
// https://github.com/prettier/eslint-config-prettier#installation
20-
// usage with Prettier, provided by 'eslint-config-prettier'.
21-
'prettier',
22-
],
23-
24-
plugins: [],
25-
26-
globals: {
27-
ga: true, // Google Analytics
28-
cordova: true,
29-
__statics: true,
30-
process: true,
31-
Capacitor: true,
32-
chrome: true,
33-
},
34-
35-
// add your custom rules here
36-
rules: {
37-
// Max line length of 100 characters, except for lines with comments or strings
38-
'max-len': [
39-
'error',
40-
{
41-
code: 100,
42-
ignoreComments: true,
43-
ignoreTrailingComments: true,
44-
ignoreStrings: true,
45-
},
46-
],
47-
},
4+
project: 'tsconfig.json',
5+
parser: '@typescript-eslint/parser'
6+
}
487
};

Diff for: umbra-js/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"files": ["build/**/*"],
88
"scripts": {
99
"test": "yarn build && mocha -r ts-node/register ./test/*.test.ts --exit --timeout 0",
10-
"lint": "eslint --ext .js .",
10+
"lint": "eslint --ext .js,.ts ./",
1111
"prettier": "prettier --write .",
1212
"watch": "tsc --watch",
1313
"build": "tsc --build",

Diff for: umbra-js/tsconfig.json

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"extends": "../tsconfig.settings.json",
33
"compilerOptions": {
44
"composite": true,
5+
"rootDir": "src",
56
"outDir": "build",
67
"resolveJsonModule": true,
78
"forceConsistentCasingInFileNames": true,

0 commit comments

Comments
 (0)