Skip to content

Commit

Permalink
UI ESLint (apache#42184)
Browse files Browse the repository at this point in the history
* 🚨 new ESLint rules and configuration.

* 🚨 fix all linting errors.

* 🚚 fix component casing.

* 🔧 add new import sorting for prettier.

* 🚨 apply new sorting of imports.

* 🔧 add missing `noUncheckedIndexedAccess` setting to avoid potential mistakes with index access.

* 📄 add license to `prettier.config.js`

* 🎨 format code examples to use spaces instead of tabs.

* 🎨 format openapi-gen files.

* 🔧 exclude `pnpm-lock.yaml` from adding a license.

* 🔧 add ignore of `pnpm-lock.yaml` in more places.
🌐 add statics word.

* 🔧 add `.vscode/settings.json`

* 🔧 add `*.tsbuildinfo` to `.gitignore`.
⬇️ downgrade typescript.

* 🔧 revert `.vscode` files ignore in gitignore.
🔥 remove `settings.json` for now.

* ⏪ revert formatting in .pre-commit-config.yaml

* 🚚 change casing of files to match main.

* 🔀 fix main merge issues -_-

* 🚚 fix incorrect main file casing change.

* 🔥 delete duplicated files that were moved in main.

* 🎨 add missing space in pre-commit-config

* ✏️ fix pnpm-lock.yaml

* 🔧 fix dist ignoring.

* 🤔 Lint and fox vite.config.ts.
  • Loading branch information
loucyx authored Sep 16, 2024
1 parent e321ce6 commit 30925c7
Show file tree
Hide file tree
Showing 60 changed files with 10,988 additions and 1,394 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,6 @@ ENV/
.idea/
*.iml

# Visual Studio Code
.vscode/

# vim
*.swp

Expand Down Expand Up @@ -173,6 +170,7 @@ pnpm-debug.log*
!.vscode/extensions.json
/.vite/
.pnpm-store
*.tsbuildinfo

# Airflow log files when airflow is run locally
airflow-*.err
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ repos:
- --fuzzy-match-generates-todo
- id: insert-license
name: Add license for all YAML files except Helm templates
exclude: ^\.github/.*$|^.*/.*_vendor/|^chart/templates/.*|.*/reproducible_build.yaml$|^airflow/api_fastapi/openapi/v1-generated.yaml$
exclude: ^\.github/.*$|^.*/.*_vendor/|^chart/templates/.*|.*/reproducible_build.yaml$|^airflow/api_fastapi/openapi/v1-generated.yaml$|^.*/pnpm-lock.yaml$
types: [yaml]
files: \.ya?ml$
args:
Expand Down
1 change: 1 addition & 0 deletions .rat-excludes
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,4 @@ v1-generated.yaml
# Front end generated files
api-generated.ts
openapi-gen
pnpm-lock.yaml
11 changes: 0 additions & 11 deletions airflow/ui/.prettierrc

This file was deleted.

1 change: 1 addition & 0 deletions airflow/ui/dev/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<script type="module" src="http://localhost:5173/@vite/client"></script>
<script type="module">
import RefreshRuntime from "http://localhost:5173/@react-refresh";

RefreshRuntime.injectIntoGlobalHook(window);
window.$RefreshReg$ = () => {};
window.$RefreshSig$ = () => (type) => type;
Expand Down
61 changes: 27 additions & 34 deletions airflow/ui/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,38 +17,31 @@
* under the License.
*/

import js from "@eslint/js";
import globals from "globals";
import reactHooks from "eslint-plugin-react-hooks";
import reactRefresh from "eslint-plugin-react-refresh";
import tseslint from "typescript-eslint";
import pluginPrettier from "eslint-plugin-prettier";
import pluginReact from "eslint-plugin-react";
/**
* @import { FlatConfig } from "@typescript-eslint/utils/ts-eslint";
*/
import { coreRules } from "./rules/core.js";
import { perfectionistRules } from "./rules/perfectionist.js";
import { prettierRules } from "./rules/prettier.js";
import { reactRules } from "./rules/react.js";
import { stylisticRules } from "./rules/stylistic.js";
import { typescriptRules } from "./rules/typescript.js";
import { unicornRules } from "./rules/unicorn.js";

export default tseslint.config(
{ ignores: ["dist", "openapi-gen"] },
{
extends: [
js.configs.recommended,
...tseslint.configs.recommended,
pluginReact.recommended,
pluginPrettier.recommended,
],
files: ["**/*.{ts,tsx}"],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
plugins: {
"react-hooks": reactHooks,
"react-refresh": reactRefresh,
},
rules: {
...reactHooks.configs.recommended.rules,
"react-refresh/only-export-components": [
"warn",
{ allowConstantExport: true },
],
},
}
);
/**
* ESLint configuration.
* @see [ESLint configuration](https://eslint.org/docs/latest/use/configure/)
*/
export default /** @type {const} @satisfies {ReadonlyArray<FlatConfig.Config>} */ ([
// Global ignore of dist directory
{ ignores: ["**/dist/"] },
// Base rules
coreRules,
typescriptRules,
// Da rest
perfectionistRules,
prettierRules,
reactRules,
stylisticRules,
unicornRules,
]);
Loading

0 comments on commit 30925c7

Please sign in to comment.