Skip to content

Commit 9696e29

Browse files
fix: add legacy fiori_tools_configure.eslintrc for both configs (#4503)
* fix: add legacy fiori_tools_configure.eslintrc for both s-4-hana and recommended config * fix: add change set * Linting auto fix commit * fix: remove js.configs.recommended.rules * fix: remove unsed * fix: typo * chore: add change set --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 4f683c5 commit 9696e29

5 files changed

Lines changed: 90 additions & 137 deletions

File tree

.changeset/huge-things-worry.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sap-ux/eslint-plugin-fiori-tools': patch
3+
---
4+
5+
Add legacy fiori_tools_configure.eslintrc for `recommended` and `recommended-for-s4hana`

.changeset/petite-memes-create.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
'@sap-ux-private/preview-middleware-client': patch
3+
---
4+
Linting auto fix

packages/eslint-plugin-fiori-tools/src/index.ts

Lines changed: 79 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { readFileSync } from 'node:fs';
22
import { join, relative, posix } from 'node:path';
33
import type { Linter } from 'eslint';
44
import type { Plugin } from '@eslint/config-helpers';
5-
import js from '@eslint/js';
65
import babelParser from '@babel/eslint-parser';
76
import typescriptEslint from '@typescript-eslint/eslint-plugin';
87
import { rules } from './rules';
@@ -57,131 +56,11 @@ const plugin: Plugin = {
5756
processors: {}
5857
};
5958

60-
/**
61-
* Common configuration shared across all config presets.
62-
*/
63-
const commonConfig: Linter.Config[] = [
64-
{
65-
languageOptions: {
66-
globals: {
67-
...globals.browser,
68-
...globals.node,
69-
...globals.es2020,
70-
sap: 'readonly'
71-
}
72-
}
73-
}
74-
];
75-
76-
// Use synckit to create sync function for project-access getPathMappingsSync
77-
const workerPath = join(__dirname, 'worker-getPathMappingsSync.js');
78-
const getPathMappingsSync = createSyncFn<typeof getPathMappings>(workerPath);
79-
80-
const pathMappingsAbsolute = getPathMappingsSync(process.cwd());
81-
const webappPathAbsolute =
82-
'webapp' in pathMappingsAbsolute
83-
? pathMappingsAbsolute.webapp
84-
: (pathMappingsAbsolute.src ?? join(process.cwd(), 'webapp'));
85-
const webappPathRelative = uniformUrl(relative(process.cwd(), webappPathAbsolute));
86-
const testPathRelative =
87-
'webapp' in pathMappingsAbsolute
88-
? posix.join(webappPathRelative, 'test')
89-
: uniformUrl(relative(process.cwd(), pathMappingsAbsolute.test ?? join(process.cwd(), 'webapp/test')));
90-
91-
const localServiceUpperCase = posix.join(webappPathRelative, 'localService');
92-
const localServiceLowerCase = posix.join(webappPathRelative, 'localservice');
93-
94-
// Base Fiori Tools rules (common across both configs)
95-
const baseFioriToolsRules = {
96-
// Error rules (alphabetical)
97-
'@sap-ux/fiori-tools/sap-no-absolute-component-path': 'error',
98-
'@sap-ux/fiori-tools/sap-no-br-on-return': 'error',
99-
'@sap-ux/fiori-tools/sap-no-commons-usage': 'error',
100-
'@sap-ux/fiori-tools/sap-no-dynamic-style-insertion': 'error',
101-
'@sap-ux/fiori-tools/sap-no-element-creation': 'error',
102-
'@sap-ux/fiori-tools/sap-no-exec-command': 'error',
103-
'@sap-ux/fiori-tools/sap-no-global-define': 'error',
104-
'@sap-ux/fiori-tools/sap-no-global-event': 'error',
105-
'@sap-ux/fiori-tools/sap-no-global-variable': 'error',
106-
'@sap-ux/fiori-tools/sap-no-hardcoded-color': 'error',
107-
'@sap-ux/fiori-tools/sap-no-hardcoded-url': 'error',
108-
'@sap-ux/fiori-tools/sap-no-inner-html-write': 'error',
109-
'@sap-ux/fiori-tools/sap-no-localstorage': 'error',
110-
'@sap-ux/fiori-tools/sap-no-location-reload': 'error',
111-
'@sap-ux/fiori-tools/sap-no-navigator': 'error',
112-
'@sap-ux/fiori-tools/sap-no-override-rendering': 'error',
113-
'@sap-ux/fiori-tools/sap-no-override-storage-prototype': 'error',
114-
'@sap-ux/fiori-tools/sap-no-sessionstorage': 'error',
115-
'@sap-ux/fiori-tools/sap-no-ui5base-prop': 'error',
116-
// Warning rules (alphabetical)
117-
'@sap-ux/fiori-tools/sap-bookmark-performance': 'warn',
118-
'@sap-ux/fiori-tools/sap-browser-api-warning': 'warn',
119-
'@sap-ux/fiori-tools/sap-cross-application-navigation': 'warn',
120-
'@sap-ux/fiori-tools/sap-forbidden-window-property': 'warn',
121-
'@sap-ux/fiori-tools/sap-message-toast': 'warn',
122-
'@sap-ux/fiori-tools/sap-no-dom-access': 'warn',
123-
'@sap-ux/fiori-tools/sap-no-dom-insertion': 'warn',
124-
'@sap-ux/fiori-tools/sap-no-encode-file-service': 'warn',
125-
'@sap-ux/fiori-tools/sap-no-global-selection': 'warn',
126-
'@sap-ux/fiori-tools/sap-no-history-manipulation': 'warn',
127-
'@sap-ux/fiori-tools/sap-no-inner-html-access': 'warn',
128-
'@sap-ux/fiori-tools/sap-no-jquery-device-api': 'warn',
129-
'@sap-ux/fiori-tools/sap-no-localhost': 'warn',
130-
'@sap-ux/fiori-tools/sap-no-location-usage': 'warn',
131-
'@sap-ux/fiori-tools/sap-no-proprietary-browser-api': 'warn',
132-
'@sap-ux/fiori-tools/sap-no-ui5-prop-warning': 'warn',
133-
'@sap-ux/fiori-tools/sap-timeout-usage': 'warn',
134-
'@sap-ux/fiori-tools/sap-ui5-forms': 'warn',
135-
'@sap-ux/fiori-tools/sap-ui5-global-eval': 'warn',
136-
'@sap-ux/fiori-tools/sap-ui5-legacy-factories': 'warn',
137-
'@sap-ux/fiori-tools/sap-ui5-legacy-jquerysap-usage': 'warn',
138-
'@sap-ux/fiori-tools/sap-usage-basemastercontroller': 'warn',
139-
// Off rules (alphabetical)
140-
'@sap-ux/fiori-tools/sap-browser-api-error': 'off',
141-
'@sap-ux/fiori-tools/sap-no-window-alert': 'off',
142-
'@sap-ux/fiori-tools/sap-ui5-no-private-prop': 'off'
143-
} as Linter.RulesRecord;
144-
145-
const prodConfig: Linter.Config[] = [
146-
{
147-
files: [`./${webappPathRelative}/**/*.js`, `./${webappPathRelative}/**/*.ts`],
148-
149-
ignores: [
150-
'target/**',
151-
`${testPathRelative}/**`,
152-
`${localServiceLowerCase}/**`, // Ignore everything in the 'localservice' folder
153-
`!${localServiceLowerCase}/**/*.{ts,js}`, // EXCEPT for .ts and .js files (that might be custom mockserver extensions)
154-
`${posix.join(localServiceLowerCase, 'mockserver.js')}`, // But DO ignore mockserver.js specifically
155-
`${localServiceUpperCase}/**`, // Ignore everything in the 'localService' folder
156-
`!${localServiceUpperCase}/**/*.{ts,js}`, // EXCEPT for .ts and .js files (that might be custom mockserver extensions)
157-
`${posix.join(localServiceUpperCase, 'mockserver.js')}`, // But DO ignore mockserver.js specifically
158-
'backup/**',
159-
'**/Gruntfile.js',
160-
'**/changes_preview.js',
161-
'**/changes_preview.ts',
162-
'**/gulpfile.js',
163-
'**/*.d.ts',
164-
'test/**'
165-
],
166-
167-
languageOptions: {
168-
parser: babelParser,
169-
parserOptions: {
170-
requireConfigFile: false
171-
}
172-
},
173-
174-
rules: {
175-
...js.configs.recommended.rules,
176-
...baseFioriToolsRules
177-
}
178-
}
179-
];
180-
181-
// Shared globals for S/4HANA config (used in both prod and test configs)
182-
const s4hanaGlobals = {
59+
// Shared globals
60+
const globalsConfig = {
18361
...globals.browser,
18462
...globals.node,
63+
...globals.es2020,
18564
...globals.amd,
18665
...globals.mocha,
18766
// SAP-specific globals (from legacy S/4HANA eslintrc)
@@ -248,9 +127,8 @@ const s4hanaGlobals = {
248127
tl: 'off',
249128
travel: 'readonly'
250129
} as const;
251-
252130
/**
253-
* Standard ESLint rules for S/4HANA config (based on legacy "fiori_tools_configure.eslintrc" configuration)
131+
* Standard ESLint rules based on legacy "fiori_tools_configure.eslintrc" configuration
254132
*
255133
* These rules were completely removed from ESLint 9 and have no direct replacement:
256134
* valid-jsdoc - Originally: ['warn', { requireReturn: false }]
@@ -267,7 +145,7 @@ const s4hanaGlobals = {
267145
* no-native-reassign → no-global-assign
268146
* no-negated-in-lhs → no-unsafe-negation
269147
*/
270-
const standardEslintRulesForS4Hana: Linter.RulesRecord = {
148+
const standardEslintRules: Linter.RulesRecord = {
271149
'no-unreachable': 'warn',
272150
'no-regex-spaces': 'error',
273151
'no-shadow': 'warn',
@@ -412,7 +290,76 @@ const standardEslintRulesForS4Hana: Linter.RulesRecord = {
412290
'no-this-before-super': 'off'
413291
};
414292

415-
const prodConfigS4Hana: Linter.Config[] = [
293+
// Use synckit to create sync function for project-access getPathMappingsSync
294+
const workerPath = join(__dirname, 'worker-getPathMappingsSync.js');
295+
const getPathMappingsSync = createSyncFn<typeof getPathMappings>(workerPath);
296+
297+
const pathMappingsAbsolute = getPathMappingsSync(process.cwd());
298+
const webappPathAbsolute =
299+
'webapp' in pathMappingsAbsolute
300+
? pathMappingsAbsolute.webapp
301+
: (pathMappingsAbsolute.src ?? join(process.cwd(), 'webapp'));
302+
const webappPathRelative = uniformUrl(relative(process.cwd(), webappPathAbsolute));
303+
const testPathRelative =
304+
'webapp' in pathMappingsAbsolute
305+
? posix.join(webappPathRelative, 'test')
306+
: uniformUrl(relative(process.cwd(), pathMappingsAbsolute.test ?? join(process.cwd(), 'webapp/test')));
307+
308+
const localServiceUpperCase = posix.join(webappPathRelative, 'localService');
309+
const localServiceLowerCase = posix.join(webappPathRelative, 'localservice');
310+
311+
// Base Fiori Tools rules (common across both configs)
312+
const baseFioriToolsRules = {
313+
// Error rules (alphabetical)
314+
'@sap-ux/fiori-tools/sap-no-absolute-component-path': 'error',
315+
'@sap-ux/fiori-tools/sap-no-br-on-return': 'error',
316+
'@sap-ux/fiori-tools/sap-no-commons-usage': 'error',
317+
'@sap-ux/fiori-tools/sap-no-dynamic-style-insertion': 'error',
318+
'@sap-ux/fiori-tools/sap-no-element-creation': 'error',
319+
'@sap-ux/fiori-tools/sap-no-exec-command': 'error',
320+
'@sap-ux/fiori-tools/sap-no-global-define': 'error',
321+
'@sap-ux/fiori-tools/sap-no-global-event': 'error',
322+
'@sap-ux/fiori-tools/sap-no-global-variable': 'error',
323+
'@sap-ux/fiori-tools/sap-no-hardcoded-color': 'error',
324+
'@sap-ux/fiori-tools/sap-no-hardcoded-url': 'error',
325+
'@sap-ux/fiori-tools/sap-no-inner-html-write': 'error',
326+
'@sap-ux/fiori-tools/sap-no-localstorage': 'error',
327+
'@sap-ux/fiori-tools/sap-no-location-reload': 'error',
328+
'@sap-ux/fiori-tools/sap-no-navigator': 'error',
329+
'@sap-ux/fiori-tools/sap-no-override-rendering': 'error',
330+
'@sap-ux/fiori-tools/sap-no-override-storage-prototype': 'error',
331+
'@sap-ux/fiori-tools/sap-no-sessionstorage': 'error',
332+
'@sap-ux/fiori-tools/sap-no-ui5base-prop': 'error',
333+
// Warning rules (alphabetical)
334+
'@sap-ux/fiori-tools/sap-bookmark-performance': 'warn',
335+
'@sap-ux/fiori-tools/sap-browser-api-warning': 'warn',
336+
'@sap-ux/fiori-tools/sap-cross-application-navigation': 'warn',
337+
'@sap-ux/fiori-tools/sap-forbidden-window-property': 'warn',
338+
'@sap-ux/fiori-tools/sap-message-toast': 'warn',
339+
'@sap-ux/fiori-tools/sap-no-dom-access': 'warn',
340+
'@sap-ux/fiori-tools/sap-no-dom-insertion': 'warn',
341+
'@sap-ux/fiori-tools/sap-no-encode-file-service': 'warn',
342+
'@sap-ux/fiori-tools/sap-no-global-selection': 'warn',
343+
'@sap-ux/fiori-tools/sap-no-history-manipulation': 'warn',
344+
'@sap-ux/fiori-tools/sap-no-inner-html-access': 'warn',
345+
'@sap-ux/fiori-tools/sap-no-jquery-device-api': 'warn',
346+
'@sap-ux/fiori-tools/sap-no-localhost': 'warn',
347+
'@sap-ux/fiori-tools/sap-no-location-usage': 'warn',
348+
'@sap-ux/fiori-tools/sap-no-proprietary-browser-api': 'warn',
349+
'@sap-ux/fiori-tools/sap-no-ui5-prop-warning': 'warn',
350+
'@sap-ux/fiori-tools/sap-timeout-usage': 'warn',
351+
'@sap-ux/fiori-tools/sap-ui5-forms': 'warn',
352+
'@sap-ux/fiori-tools/sap-ui5-global-eval': 'warn',
353+
'@sap-ux/fiori-tools/sap-ui5-legacy-factories': 'warn',
354+
'@sap-ux/fiori-tools/sap-ui5-legacy-jquerysap-usage': 'warn',
355+
'@sap-ux/fiori-tools/sap-usage-basemastercontroller': 'warn',
356+
// Off rules (alphabetical)
357+
'@sap-ux/fiori-tools/sap-browser-api-error': 'off',
358+
'@sap-ux/fiori-tools/sap-no-window-alert': 'off',
359+
'@sap-ux/fiori-tools/sap-ui5-no-private-prop': 'off'
360+
} as Linter.RulesRecord;
361+
362+
const prodConfig: Linter.Config[] = [
416363
{
417364
files: [`./${webappPathRelative}/**/*.js`, `./${webappPathRelative}/**/*.ts`],
418365

@@ -439,11 +386,10 @@ const prodConfigS4Hana: Linter.Config[] = [
439386
parserOptions: {
440387
requireConfigFile: false
441388
},
442-
globals: s4hanaGlobals
389+
globals: globalsConfig
443390
},
444-
445391
rules: {
446-
...standardEslintRulesForS4Hana,
392+
...standardEslintRules,
447393
...baseFioriToolsRules
448394
}
449395
}
@@ -459,7 +405,7 @@ const testConfig: Linter.Config[] = [
459405
parserOptions: {
460406
requireConfigFile: false
461407
},
462-
globals: s4hanaGlobals
408+
globals: globalsConfig
463409
},
464410

465411
rules: {
@@ -550,7 +496,6 @@ export const configs: Record<string, Linter.Config[]> = {
550496
}
551497
}
552498
},
553-
...commonConfig,
554499
...typescriptConfig,
555500
...prodConfig,
556501
...testConfig
@@ -565,9 +510,8 @@ export const configs: Record<string, Linter.Config[]> = {
565510
}
566511
}
567512
},
568-
...commonConfig,
569513
...typescriptConfig,
570-
...prodConfigS4Hana,
514+
...prodConfig,
571515
...testConfig,
572516
...fioriLanguageConfig
573517
]

packages/preview-middleware-client/src/adp/quick-actions/fe-v4/create-table-custom-column-config-change.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ function findAnchor(table: UI5Element): string {
123123
'com.sap.vocabularies.UI.v1.DataFieldForIntentBasedNavigation',
124124
'com.sap.vocabularies.UI.v1.DataFieldForAnnotation'
125125
].includes(col.$Type) ||
126-
('com.sap.vocabularies.UI.v1.DataFieldForAction' === col.$Type && col.Inline)
126+
(col.$Type === 'com.sap.vocabularies.UI.v1.DataFieldForAction' && col.Inline)
127127
) as {
128128
$Type: string;
129129
Inline?: boolean;

packages/preview-middleware-client/src/flp/WorkspaceConnector.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { CHANGES_API_PATH as CHANGES_API_PATH_STATIC, getFlexSettings } from './
66
import { getUi5Version, isLowerThanMinimalUi5Version } from '../utils/version';
77
import { getAdditionalChangeInfo } from '../utils/additional-change-info';
88

9-
const baseUrl = document.getElementById('sap-ui-bootstrap')?.dataset.openUxPreviewBaseUrl ??'';
9+
const baseUrl = document.getElementById('sap-ui-bootstrap')?.dataset.openUxPreviewBaseUrl ?? '';
1010
const changesApiPath = `${baseUrl}${CHANGES_API_PATH_STATIC}`;
1111

1212
const connector = merge({}, ObjectStorageConnector, {

0 commit comments

Comments
 (0)