Skip to content
Merged
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,6 @@ package.json
# temp folders - remove in future after fix all issues
redisinsight/ui/src/packages/redisgraph
redisinsight/ui/src/packages/redistimeseries-app

/report
__mocks__
43 changes: 32 additions & 11 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,21 @@ module.exports = {
node: true,
browser: true,
},
extends: ['airbnb-typescript'],
extends: ['airbnb-typescript', 'prettier'],
plugins: ['@typescript-eslint'],
parser: '@typescript-eslint/parser',
rules: {
semi: ['error', 'never'],
semi: ['error', 'always'],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change this? It will probably cause a lot of changes, that could be avoided

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's because I needed to override it. Currently we don't put ; on .ts files, which is OK. However, it's not the best practice for .js files as there are cases where problems may occur:

function test() {
  return
  {
    message: "Hello, world!"
  }
}

console.log(test())

So, below in this file are the override settings.

quotes: [2, 'single', { avoidEscape: true }],
'max-len': ['error', { ignoreComments: true, ignoreStrings: true, ignoreRegExpLiterals: true, code: 120 }],
'max-len': [
'error',
{
ignoreComments: true,
ignoreStrings: true,
ignoreRegExpLiterals: true,
code: 120,
},
],
'class-methods-use-this': 'off',
'import/no-extraneous-dependencies': 'off', // temporary disabled
'@typescript-eslint/semi': ['error', 'never'],
Expand All @@ -33,32 +41,45 @@ module.exports = {
{
pattern: 'desktopSrc/**',
group: 'internal',
position: 'after'
position: 'after',
},
{
pattern: 'uiSrc/**',
group: 'internal',
position: 'after'
position: 'after',
},
{
pattern: 'apiSrc/**',
group: 'internal',
position: 'after'
position: 'after',
},
],
warnOnUnassignedImports: true,
pathGroupsExcludedImportTypes: ['builtin']
pathGroupsExcludedImportTypes: ['builtin'],
},
],
},
overrides: [
{
files: ['*.ts', '*.tsx'],
rules: {
'@typescript-eslint/semi': ['error', 'never'],
semi: 'off',
},
},
{
files: ['*.js', '*.jsx', '*.cjs'],
rules: {
semi: ['error', 'always'],
'@typescript-eslint/semi': 'off',
},
},
],
parserOptions: {
project: './tsconfig.json',
ecmaVersion: 2020,
sourceType: 'module',
createDefaultProgram: true,
},
ignorePatterns: [
'redisinsight/ui',
'redisinsight/api',
],
ignorePatterns: ['redisinsight/ui', 'redisinsight/api'],
}
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tests/e2e
**/*.scss
11 changes: 11 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"semi": true,
"overrides": [
{
"files": ["**/*.ts", "**/*.tsx"],
"options": {
"semi": false
}
}
]
}
9 changes: 9 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
"lint:api": "yarn --cwd redisinsight/api lint",
"lint:desktop": "eslint ./redisinsight/desktop",
"lint:e2e": "yarn --cwd tests/e2e lint",
"prettier": "prettier --check .",
"prettier:update": "prettier --write .",
"package": "yarn package:dev",
"package:prod": "ts-node ./scripts/prebuild.js dist && yarn build:prod && electron-builder build -p never",
"package:stage": "ts-node ./scripts/prebuild.js dist && yarn build:stage && electron-builder build -p never -c.mac.bundleVersion=$GITHUB_RUN_ID",
Expand Down Expand Up @@ -135,8 +137,8 @@
"@types/text-encoding": "^0.0.37",
"@types/uuid": "^8.3.4",
"@types/webpack-env": "^1.18.4",
"@typescript-eslint/eslint-plugin": "^4.8.1",
"@typescript-eslint/parser": "^4.8.1",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"@vitejs/plugin-react": "^4.2.1",
"@vitejs/plugin-react-swc": "^3.6.0",
"assert": "^2.1.0",
Expand All @@ -160,6 +162,7 @@
"eslint": "^7.5.0",
"eslint-config-airbnb": "^18.2.1",
"eslint-config-airbnb-typescript": "^12.0.0",
"eslint-config-prettier": "10.0.2",
"eslint-import-resolver-webpack": "0.13.8",
"eslint-plugin-compat": "^3.8.0",
"eslint-plugin-import": "^2.22.0",
Expand Down Expand Up @@ -187,6 +190,7 @@
"msw": "^1.3.4",
"patch-package": "^8.0.0",
"postinstall-postinstall": "^2.1.0",
"prettier": "3.5.2",
"react-refresh": "^0.9.0",
"redux-mock-store": "^1.5.4",
"regenerator-runtime": "^0.13.5",
Expand Down
12 changes: 6 additions & 6 deletions redisinsight/api/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ module.exports = {
env: {
node: true,
},
extends: ['airbnb-typescript/base', 'plugin:sonarjs/recommended'],
extends: ['airbnb-typescript/base', 'plugin:sonarjs/recommended', 'prettier'],
plugins: ['@typescript-eslint', 'sonarjs'],
parser: '@typescript-eslint/parser',
rules: {
'max-len': ['warn', 120],
'@typescript-eslint/return-await': 'off',
"@typescript-eslint/dot-notation": "off",
'@typescript-eslint/dot-notation': 'off',
'import/prefer-default-export': 'off', // ignore "export default" requirement
'max-classes-per-file': 'off',
'class-methods-use-this': 'off', // should be ignored since NestJS allow inheritance without using "this" inside class methods
Expand All @@ -21,12 +21,12 @@ module.exports = {
},
overrides: [
{
files: [ '**/*.spec.ts', '**/__mocks__/**/*' ],
files: ['**/*.spec.ts', '**/__mocks__/**/*'],
rules: {
'sonarjs/no-duplicate-string': 0,
'sonarjs/no-identical-functions': 0,
'import/first': 0,
}
}
]
},
},
],
};
60 changes: 43 additions & 17 deletions redisinsight/ui/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
const path = require('path')
const path = require('path');

module.exports = {
root: true,
env: {
browser: true,
},
extends: ['airbnb-typescript', 'airbnb/hooks', 'plugin:sonarjs/recommended'],
extends: [
'airbnb-typescript',
'airbnb/hooks',
'plugin:sonarjs/recommended',
'prettier',
],
// extends: ['airbnb', 'airbnb/hooks'],
plugins: ['@typescript-eslint'],
parser: '@typescript-eslint/parser',
Expand All @@ -18,23 +23,44 @@ module.exports = {

overrides: [
{
files: [
'**/*.spec.ts',
'**/*.spec.tsx',
'**/*.spec.ts',
],
files: ['**/*.spec.ts', '**/*.spec.tsx', '**/*.spec.ts'],
env: {
jest: true,
},
},
{
files: ['*.ts', '*.tsx'],
rules: {
'@typescript-eslint/semi': ['error', 'never'],
semi: 'off',
},
},
{
files: ['*.js', '*.jsx'],
rules: {
semi: ['error', 'always'],
'@typescript-eslint/semi': 'off',
},
},
],
ignorePatterns: [
'dist',
'src/packages/redisearch/src/icons/*.js',
'src/packages/common/src/icons/*.js',
],
ignorePatterns: ['dist', 'src/packages/redisearch/src/icons/*.js', 'src/packages/common/src/icons/*.js'],

rules: {
radix: 'off',
semi: ['error', 'never'],
semi: ['error', 'always'],
'no-bitwise': ['error', { allow: ['|'] }],
'max-len': ['error', { ignoreComments: true, ignoreStrings: true, ignoreRegExpLiterals: true, code: 120 }],
'max-len': [
'error',
{
ignoreComments: true,
ignoreStrings: true,
ignoreRegExpLiterals: true,
code: 120,
},
],
'class-methods-use-this': 'off',
// A temporary hack related to IDE not resolving correct package.json
'import/no-extraneous-dependencies': 'off',
Expand Down Expand Up @@ -82,23 +108,23 @@ module.exports = {
{
pattern: 'uiSrc/**',
group: 'internal',
position: 'after'
position: 'after',
},
{
pattern: 'apiSrc/**',
group: 'internal',
position: 'after'
position: 'after',
},
{
pattern: '{.,..}/*.scss', // same directory only
// pattern: '{.,..}/**/*\.scss' // same & outside directories (e.g. import '../foo/foo.scss')
group: 'object',
position: 'after'
}
position: 'after',
},
],
warnOnUnassignedImports: true,
pathGroupsExcludedImportTypes: ['builtin']
pathGroupsExcludedImportTypes: ['builtin'],
},
],
},
}
};
Loading
Loading