-
Notifications
You must be signed in to change notification settings - Fork 53
refactor: Update ESLint configurations for ESLint 9 compatibility #3788
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: eslint9
Are you sure you want to change the base?
refactor: Update ESLint configurations for ESLint 9 compatibility #3788
Conversation
devinea
commented
Oct 30, 2025
- Migrate eslint-plugin-fiori-custom from rel-npmjs branch
- Convert to TypeScript with passing tests
- Update ESLint configurations and improve rule definitions
- Change TypeScript ESLint configuration to use recommendedTypeChecked
- Enhance rule exports for better compatibility and lazy loading
- Remove author information from rule files for consistency
- Add fiori-custom plugin for backward compatibility
- Fix eslint-plugin-eslint-plugin lint issues
- Apply multiple lint fixes throughout the codebase
- Migrate eslint-plugin-fiori-custom from rel-npmjs branch - Convert to TypeScript with passing tests - Update ESLint configurations and improve rule definitions - Change TypeScript ESLint configuration to use recommendedTypeChecked - Enhance rule exports for better compatibility and lazy loading - Remove author information from rule files for consistency - Add fiori-custom plugin for backward compatibility - Fix eslint-plugin-eslint-plugin lint issues - Apply multiple lint fixes throughout the codebase
|
…i_custom_into_fiori_tools_plugin * origin/eslint9: chore: apply latest changesets 3792/handle missing mta binary (#3793) chore: apply latest changesets feat(sap-systems): adds new SAP Systems extension (#3752) chore: apply latest changesets fix(backend-proxy-middleware): wrong 'path' and 'pathReplace' in case of appStudio full destination (#3787)
…i_custom_into_fiori_tools_plugin * origin/eslint9: (52 commits) chore: apply latest changesets update building block svg (#3826) chore: apply latest changesets feat(create): auto generate readme on build (#3760) chore: apply latest changesets Resolve Transport Request Checks for Download Quick Fiori App Deploy (#3819) test: v4 project builder (#3682) chore: apply latest changesets fix: bump specVersion to v4.0 (#3744) chore: apply latest changesets test: Integration test for fiori MCP using promptfoo (#3705) chore: apply latest changesets fix: move message to store creds prompt, tests, changeset (#3820) chore: apply latest changesets fix: bump fallback versions (#3813) chore: apply latest changesets chore - upgrade ui5 devDeps (#3771) correct publisher to SAPOSS (#3817) chore: apply latest changesets fix: cloud system render logic, message wording, test connection logging (#3811) ...
heimwege
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments
- a lot of older notation is being used here (could also be refactored after merge). Did not check all rules but I think the pattern is clearly visible 😄
- a lot of
anytypes - a lot of comments with code that might no longer be needed 🤷🏻
- migration of eslint config lgtm
- linting adjustment to existing packages lgtm
| ...globals.browser, | ||
| ...globals.node | ||
| ...globals.node, | ||
| 'sap': 'readonly' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity: why is this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addresses error
1:1 error 'sap' is not defined no-undef
E.g. in file https://github.com/SAP/open-ux-tools/blob/main/packages/fiori-freestyle-writer/templates/common/add/1.120.0/webapp/model/models.js#L1
Not sure if there is a better way to handle this.
packages/eslint-plugin-fiori-tools/src/reporter/helpers/styles.html
Outdated
Show resolved
Hide resolved
packages/eslint-plugin-fiori-tools/src/reporter/template-generator.ts
Outdated
Show resolved
Hide resolved
| * @param a | ||
| * @param obj | ||
| */ | ||
| function contains(a, obj) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there should be types, right?
| * @param s | ||
| * @param sub | ||
| */ | ||
| function endsWith(s, sub) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where are all those parameter types gone? Seems a general issue in this rule file
packages/eslint-plugin-fiori-tools/src/rules/sap-message-toast.ts
Outdated
Show resolved
Hide resolved
packages/eslint-plugin-fiori-tools/src/rules/sap-message-toast.ts
Outdated
Show resolved
Hide resolved
packages/eslint-plugin-fiori-tools/src/rules/sap-message-toast.ts
Outdated
Show resolved
Hide resolved
…i_custom_into_fiori_tools_plugin * origin/eslint9: Move cpe integration test (#3783) chore: apply latest changesets fix(fiori-docs-embeddings): use existing ux-ui5-readme in case of error (#3830) chore: apply latest changesets feat(ADP)(OData): Display in the Info center the OData service connectivity status at startup of the Visual Editor. (#3560) Revert "fix: run tests on windows (#3823)" (#3835) fix for lint commit not starting the main build on the PR (#3833) chore: apply latest changesets Updating remaining ui5 cli references to v4 and align version (#3824) chore: apply latest changesets feat: Replace existing inbounds scenario now replaces all inbounds in FLP configuration generator for ADP (#3773) chore: apply latest changesets fix: improve handling for saving systems (#3828) chore: apply latest changesets chore: Update `@sap/cf-tools` version to latest to avoid security issues (#3809) chore: apply latest changesets feat(fiori-docs-embeddings): add @sap-ux/create/README.md as resource (#3779) fix: run tests on windows (#3823)
Removed /*eslint-disable strict*/ Replaced any types with proper TypeScript types Optional chaining Use template literals instead of string concatenation Use Array.at(-1) for accessing last elements Removed commented-out code blocks Replaced non-inclusive language
…ormance.ts Co-authored-by: Dominik Heim <[email protected]>
Co-authored-by: Dominik Heim <[email protected]>
…fiori_tools_plugin' into eslint9_merge_fiori_custom_into_fiori_tools_plugin * origin/eslint9_merge_fiori_custom_into_fiori_tools_plugin: Update packages/eslint-plugin-fiori-tools/src/rules/sap-message-toast.ts Update packages/eslint-plugin-fiori-tools/src/rules/sap-bookmark-performance.ts
Klaus-Keller
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Klaus-Keller yes. Done in 4a4c24c |
…i_custom_into_fiori_tools_plugin * origin/eslint9: fix(deps): update dependency js-yaml [security] (#3840) chore: apply latest changesets fix(odata-service-inquirer): Validation messages for credential fail (#3815) chore: apply latest changesets sap-systems-ext: update extension name and readme (#3849) chore: apply latest changesets fix(sap-systems-ext): title update and import fix for sap systems ext (#3843) chore: apply latest changesets fix(odata-service-inq): add try catch to fetching backend systems from store (#3839) chore: apply latest changesets feat: Store view name as part of additional info in fragment body (#3696) chore: apply latest changesets feat(fpm-writer): Filter building block custom filter (#3767) chore: apply latest changesets fix(mcp-server): allow to create object pages in v2 (#3795) feat: add test cases for java project (#3825) chore: apply latest changesets fix: inlude require when generate custom field fragment with event handler (#3836)
…i_custom_into_fiori_tools_plugin * origin/eslint9: revert templates and snapshots
|
@devinea your thought on not adjusting the version in the
|
… Should be removed again when prettier upgraded
|
marufrasully
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @devinea
- in general looks good to me
- small comments
- did not test it locally
| branches: [main] | ||
| branches: | ||
| - main | ||
| - 'eslint9**' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is meant for only current PR or we plane to have another branch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also have this PR #3827
It can be removed later.
|
|
||
| rules: { | ||
| ...js.configs.recommended.rules, | ||
| '@sap-ux/fiori-tools/sap-no-global-variable': 'error', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may make sense to sort them. AI can help here :)
rules: {
...js.configs.recommended.rules,
// Error rules
'@sap-ux/fiori-tools/sap-no-global-variable': 'error',
'@sap-ux/fiori-tools/sap-no-hardcoded-color': 'error',
'@sap-ux/fiori-tools/sap-no-hardcoded-url': 'error',
'@sap-ux/fiori-tools/sap-no-localstorage': 'error',
'@sap-ux/fiori-tools/sap-no-override-rendering': 'error',
'@sap-ux/fiori-tools/sap-no-override-storage-prototype': 'error',
'@sap-ux/fiori-tools/sap-no-sessionstorage': 'error',
'@sap-ux/fiori-tools/sap-no-ui5base-prop': 'error',
'@sap-ux/fiori-tools/sap-no-absolute-component-path': 'error',
'@sap-ux/fiori-tools/sap-no-location-reload': 'error',
'@sap-ux/fiori-tools/sap-no-global-event': 'error',
'@sap-ux/fiori-tools/sap-no-exec-command': 'error',
'@sap-ux/fiori-tools/sap-no-br-on-return': 'error',
'@sap-ux/fiori-tools/sap-no-dynamic-style-insertion': 'error',
'@sap-ux/fiori-tools/sap-no-element-creation': 'error',
'@sap-ux/fiori-tools/sap-no-global-define': 'error',
'@sap-ux/fiori-tools/sap-no-navigator': 'error',
'@sap-ux/fiori-tools/sap-no-inner-html-write': 'error',
'@sap-ux/fiori-tools/sap-no-commons-usage': 'error',
// Warning rules
'@sap-ux/fiori-tools/sap-no-jquery-device-api': 'warn',
'@sap-ux/fiori-tools/sap-message-toast': 'warn',
'@sap-ux/fiori-tools/sap-no-ui5-prop-warning': 'warn',
'@sap-ux/fiori-tools/sap-no-localhost': 'warn',
'@sap-ux/fiori-tools/sap-usage-basemastercontroller': 'warn',
'@sap-ux/fiori-tools/sap-no-encode-file-service': 'warn',
'@sap-ux/fiori-tools/sap-no-dom-insertion': 'warn',
'@sap-ux/fiori-tools/sap-cross-application-navigation': 'warn',
'@sap-ux/fiori-tools/sap-no-location-usage': 'warn',
'@sap-ux/fiori-tools/sap-timeout-usage': 'warn',
'@sap-ux/fiori-tools/sap-no-proprietary-browser-api': 'warn',
'@sap-ux/fiori-tools/sap-no-dom-access': 'warn',
'@sap-ux/fiori-tools/sap-no-history-manipulation': 'warn',
'@sap-ux/fiori-tools/sap-no-global-selection': 'warn',
'@sap-ux/fiori-tools/sap-forbidden-window-property': 'warn',
'@sap-ux/fiori-tools/sap-no-inner-html-access': 'warn',
'@sap-ux/fiori-tools/sap-bookmark-performance': 'warn',
'@sap-ux/fiori-tools/sap-browser-api-warning': 'warn',
'@sap-ux/fiori-tools/sap-ui5-legacy-jquerysap-usage': 'warn',
'@sap-ux/fiori-tools/sap-ui5-global-eval': 'warn',
'@sap-ux/fiori-tools/sap-ui5-legacy-factories': 'warn',
'@sap-ux/fiori-tools/sap-ui5-forms': 'warn',
// Off rules
'@sap-ux/fiori-tools/sap-ui5-no-private-prop': 'off',
'@sap-ux/fiori-tools/sap-browser-api-error': 'off',
'@sap-ux/fiori-tools/sap-no-window-alert': 'off'
}There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Group by error, warn and off and sort within by rule name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Group by error, warn and off.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the benefit of grouping them by severity because that is something that can change? I can see a scenario where you introduce a new rule and start as warning and later on change it to error, but then you have to also reorder them and that seems a bit strange.
|
|
||
| const typescriptEslint = require("@typescript-eslint/eslint-plugin"); | ||
| const tsParser = require("@typescript-eslint/parser"); | ||
| const js = require("@eslint/js"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
js and tseslint seems un-used
|
|
||
| For example Windows uses CR+LF (carriage return and line-feed characters) whereas Unix only uses the LF character. | ||
|
|
||
| Mixed kinds of line-endings in the same repository can cause code reviews or automatic merging to be . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to be ? we are missing a verb here.
| "@sap/ux-ui5-tooling": "1", | ||
| "@sap-ux/eslint-plugin-fiori-tools": "^0.5.0", | ||
| "eslint": "^9", | ||
| "@sap-ux/eslint-plugin-fiori-tools": "^0.4.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use "workspace:*" instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. The expected output are not part of the workspace.
| // may not be available when the plugin itself is loaded | ||
| export const configs = { | ||
| // Recommended config for JavaScript projects (prod + test) | ||
| get recommended(): Linter.Config[] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we stick to only recommended and recommended-typescript?


