From 109afd30aaf5e3bcdfd77ca4c77859d38f86ba19 Mon Sep 17 00:00:00 2001 From: kohinoor98 Date: Wed, 15 Nov 2023 00:53:19 -0800 Subject: [PATCH 1/3] precommit and tsconfig changes Signed-off-by: kohinoor98 --- .eslintrc.js | 22 ++++++++++++++++++++++ .lintstagedrc | 8 +++++++- package.json | 4 +++- tsconfig.json | 3 ++- 4 files changed, 34 insertions(+), 3 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 562ff10ff..3e93ad12a 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -15,6 +15,28 @@ module.exports = { extends: ["@elastic/eslint-config-kibana", "plugin:@elastic/eui/recommended"], rules: { // "@osd/eslint/require-license-header": "off" + "import/no-default-export": "off", + "@typescript-eslint/naming-convention": [ + "error", + { + selector: "default", + format: ["camelCase", "UPPER_CASE", "PascalCase", "snake_case"], + leadingUnderscore: "allow", + trailingUnderscore: "allow", + }, + ], + "@osd/eslint/no-restricted-paths": [ + "error", + { + basePath: __dirname, + zones: [ + { + target: ["(public|server)/**/*"], + from: ["../../packages/**/*", "packages/**/*"], + }, + ], + }, + ], }, overrides: [ { diff --git a/.lintstagedrc b/.lintstagedrc index e7e7db117..e155bc449 100644 --- a/.lintstagedrc +++ b/.lintstagedrc @@ -1,3 +1,9 @@ { - "*.{ts,tsx,js,jsx,json,css,md}": ["prettier --write", "git add"] + "*.{ts,tsx}": [ + "npx eslint --fix", + "prettier --write" + ], + "*.{js,jsx,json,css,md}": [ + "prettier --write" + ] } diff --git a/package.json b/package.json index 7c079c666..3832dff8d 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,8 @@ "osd": "node ../../scripts/osd", "opensearch": "node ../../scripts/opensearch", "lint": "node ../../scripts/eslint . && node ../../scripts/stylelint", + "eslint:fix": "npx eslint '**/*.{ts,tsx}' --fix", + "eslint:run": "npx eslint '**/*.{ts,tsx}'", "plugin-helpers": "node ../../scripts/plugin_helpers", "test:jest": "../../node_modules/.bin/jest --config ./test/jest.config.js", "build": "yarn plugin-helpers build", @@ -73,4 +75,4 @@ "engines": { "yarn": "^1.21.1" } -} \ No newline at end of file +} diff --git a/tsconfig.json b/tsconfig.json index 4f79bdc75..a3674d086 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,6 +8,7 @@ "compilerOptions": { "skipLibCheck": true, "esModuleInterop": true, - "outDir": "./target" + "outDir": "./target", + "strictNullChecks": true } } From 277f73cd18bdce8a429d6a9dd640664fd2959cb0 Mon Sep 17 00:00:00 2001 From: kohinoor98 Date: Wed, 15 Nov 2023 01:14:48 -0800 Subject: [PATCH 2/3] reverting tsconfig changes Signed-off-by: kohinoor98 --- tsconfig.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index a3674d086..4f79bdc75 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,7 +8,6 @@ "compilerOptions": { "skipLibCheck": true, "esModuleInterop": true, - "outDir": "./target", - "strictNullChecks": true + "outDir": "./target" } } From b2d9c12c75e5e23d91425978c13bfdee3b0e95ea Mon Sep 17 00:00:00 2001 From: Kohinoor Chatterjee Date: Sat, 6 Jan 2024 15:51:14 -0800 Subject: [PATCH 3/3] Update package.json Co-authored-by: SuZhou-Joe Signed-off-by: Kohinoor Chatterjee --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3832dff8d..3f26c4b4b 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "osd": "node ../../scripts/osd", "opensearch": "node ../../scripts/opensearch", "lint": "node ../../scripts/eslint . && node ../../scripts/stylelint", - "eslint:fix": "npx eslint '**/*.{ts,tsx}' --fix", + "eslint:fix": "yarn eslint:run --fix", "eslint:run": "npx eslint '**/*.{ts,tsx}'", "plugin-helpers": "node ../../scripts/plugin_helpers", "test:jest": "../../node_modules/.bin/jest --config ./test/jest.config.js",