Skip to content

Commit 165a6c2

Browse files
marufrasullygithub-actions[bot]longieirlheimwege
authored
feat: support eslint 10 (#4439)
* feat: add eslint 10 support * fix: add eslint 10 for rest of modules * fix: remove deprecated property * fix: add change set * Linting auto fix commit * fix Jest 30 Enzyme compatibility by resolving Cheerio exports and required web API polyfills * fix: failing test * fix: failing test and review comment * chore: merge main into feat/support-eslint-10 and resolve conflicts - examples/fe-fpm-cli: take mains newer @types/vinyl and typescript-eslint - examples/ui-prompting-examples: take mains css-loader 7.1.4, keep eslint 9.39.1 (React package) - package.json: keep eslint 10.0.3 from PR; take mains newer @types/node, esbuild, typescript-eslint - eslint-plugin-fiori-tools: peerDep eslint set to >=9 (supports both 9 and 10) - eslint-plugin-fiori-tools/src/index.ts: keep fioriRules alias in both config exports - preview-middleware-client/eslint.config.js: take mains corrected tseslint.plugin/parser usage * chore: merge origin/main into feat/support-eslint-10 (batch 2) * chore: update pnpm-lock.yaml after merging main into feat/support-eslint-10 * chore: remove WIP files that don't belong on this branch Candidate 1 mta-config refactor files and RFC docs were accidentally committed during the main merge. They belong on a separate refactor/cf-deploy-config-mta-god-class branch. * chore: consolidate eslint-10 changesets * fix(ui-components): resolve cheerio/lib/utils to physical pnpm path for Jest moduleNameMapper * test: improve coverage for eslint-10 migration changes - sap-no-override-rendering: add valid/invalid cases with custom ns options to cover the context.options[0]?.ns ternary branch - create-table-custom-column-config-change: add test for findAnchor() IIFE branch when metaPath does not contain 'LineItem', triggering getLineItemAnnotation() to compute the annotation path * fix: adapte peerDependencies * Update packages/app-config-writer/test/unit/eslint-config/convert.test.ts Co-authored-by: Dominik Heim <[email protected]> * fix: remove un-used file * fix: cst * fix: exclude type declaration files from coverage * fix: major bump for @sap-ux/eslint-plugin-fiori-tools --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: John Long <[email protected]> Co-authored-by: Dominik Heim <[email protected]>
1 parent a5b6bc9 commit 165a6c2

136 files changed

Lines changed: 915 additions & 755 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/fair-adults-cheat.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
'@sap-ux/eslint-plugin-fiori-tools': major
3+
'@sap-ux/app-config-writer': patch
4+
'@sap-ux/ui5-application-writer': patch
5+
'@sap-ux/ui5-library-writer': patch
6+
'@sap-ux-private/preview-middleware-client': patch
7+
---
8+
9+
feat: support ESLint 10

examples/ui-prompting-examples/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
"babel-loader": "10.1.1",
5454
"copyfiles": "2.4.1",
5555
"css-loader": "7.1.4",
56+
"eslint": "9.39.1",
5657
"eslint-plugin-react": "7.37.5",
5758
"eslint-plugin-storybook": "0.6.15",
5859
"mem-fs": "2.1.0",

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
"devDependencies": {
88
"@changesets/cli": "2.30.0",
99
"@eslint/eslintrc": "3.3.5",
10-
"@eslint/js": "9.22.0",
10+
"@eslint/js": "10.0.1",
1111
"@playwright/test": "1.58.2",
1212
"@types/jest": "30.0.0",
1313
"@types/node": "20.19.37",
1414
"autoprefixer": "10.4.27",
1515
"check-dependency-version-consistency": "6.0.0",
1616
"esbuild": "0.27.4",
1717
"esbuild-sass-plugin": "3.7.0",
18-
"eslint": "9.39.1",
18+
"eslint": "10.0.3",
1919
"eslint-config-prettier": "10.1.8",
2020
"eslint-import-resolver-typescript": "4.4.4",
2121
"eslint-plugin-import": "2.32.0",

packages/app-config-writer/src/eslint-config/convert.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,8 @@ async function updatePackageJson(basePath: string, fs: Editor, logger?: ToolsLog
369369
const packageJsonPath = join(basePath, FileName.Package);
370370
const packageJson = fs.readJSON(packageJsonPath) as Package;
371371
packageJson.devDependencies ??= {};
372-
packageJson.devDependencies[packageName.ESLINT] = '^9.0.0';
373-
packageJson.devDependencies[packageName.ESLINT_PLUGIN_FIORI_TOOLS] = '^9.0.0';
372+
packageJson.devDependencies[packageName.ESLINT] = '^10.0.0';
373+
packageJson.devDependencies[packageName.ESLINT_PLUGIN_FIORI_TOOLS] = '^10.0.0';
374374
delete packageJson.devDependencies[packageName.ESLINT_PLUGIN_FIORI_CUSTOM];
375375
packageJson.scripts ??= {};
376376
if (packageJson.scripts['lint']) {

packages/app-config-writer/test/unit/eslint-config/add.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ describe('generateEslintConfig', () => {
7979
const packageJson = fs.readJSON(packageJsonPath) as Package;
8080

8181
expect(packageJson.devDependencies).toBeDefined();
82-
expect(packageJson.devDependencies?.eslint).toBe('^9');
83-
expect(packageJson.devDependencies?.['@sap-ux/eslint-plugin-fiori-tools']).toBe('^9.0.0');
82+
expect(packageJson.devDependencies?.eslint).toBe('^10');
83+
expect(packageJson.devDependencies?.['@sap-ux/eslint-plugin-fiori-tools']).toBe('^10.0.0');
8484
});
8585

8686
test('should add lint script to package.json', async () => {

packages/app-config-writer/test/unit/eslint-config/convert.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -610,17 +610,17 @@ describe('convertEslintConfig', () => {
610610
const packageJsonPath = join(basePath, 'package.json');
611611
const packageJson = fs.readJSON(packageJsonPath) as Package;
612612

613-
expect(packageJson.devDependencies?.eslint).toBe('^9.0.0');
613+
expect(packageJson.devDependencies?.eslint).toBe('^10.0.0');
614614
});
615615

616-
test('should update @sap-ux/eslint-plugin-fiori-tools version to ^9.0.0', async () => {
616+
test('should update @sap-ux/eslint-plugin-fiori-tools version to ^10.0.0', async () => {
617617
const basePath = join(__dirname, '../../fixtures/eslint-config/existing-config');
618618
await convertEslintConfig(basePath, { logger: loggerMock, fs });
619619

620620
const packageJsonPath = join(basePath, 'package.json');
621621
const packageJson = fs.readJSON(packageJsonPath) as Package;
622622

623-
expect(packageJson.devDependencies?.['@sap-ux/eslint-plugin-fiori-tools']).toBe('^9.0.0');
623+
expect(packageJson.devDependencies?.['@sap-ux/eslint-plugin-fiori-tools']).toBe('^10.0.0');
624624
});
625625

626626
test('should preserve existing devDependencies', async () => {
@@ -660,7 +660,7 @@ describe('convertEslintConfig', () => {
660660

661661
const updatedPackageJson = fs.readJSON(packageJsonPath) as Package;
662662
expect(updatedPackageJson.devDependencies).toBeDefined();
663-
expect(updatedPackageJson.devDependencies?.eslint).toBe('^9.0.0');
663+
expect(updatedPackageJson.devDependencies?.eslint).toBe('^10.0.0');
664664
});
665665
});
666666

@@ -762,8 +762,8 @@ describe('convertEslintConfig', () => {
762762
// Verify package.json was updated
763763
const packageJsonPath = join(basePath, 'package.json');
764764
const packageJson = fs.readJSON(packageJsonPath) as Package;
765-
expect(packageJson.devDependencies?.eslint).toBe('^9.0.0');
766-
expect(packageJson.devDependencies?.['@sap-ux/eslint-plugin-fiori-tools']).toBe('^9.0.0');
765+
expect(packageJson.devDependencies?.eslint).toBe('^10.0.0');
766+
expect(packageJson.devDependencies?.['@sap-ux/eslint-plugin-fiori-tools']).toBe('^10.0.0');
767767

768768
// Verify result is the fs instance
769769
expect(result).toBe(fs);

packages/control-property-editor/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"@types/remote-redux-devtools": "0.5.8",
3838
"@types/source-map-support": "0.5.10",
3939
"@types/react": "16.14.69",
40+
"eslint": "9.39.1",
4041
"eslint-plugin-react": "7.37.5",
4142
"http-proxy-middleware": "3.0.5",
4243
"i18next": "25.10.10",

packages/eslint-plugin-fiori-tools/jest.config.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,11 @@ module.exports = {
33
...config,
44
// coverageProvider: 'v8' overrides jest.base default ('babel'); collectCoverage: true is inherited from jest.base
55
coverageProvider: 'v8',
6-
setupFiles: ['<rootDir>/test/global-setup.ts']
7-
}
6+
setupFiles: ['<rootDir>/test/global-setup.ts'],
7+
coveragePathIgnorePatterns: [
8+
'src/types.ts',
9+
'src/language/annotations/types.ts',
10+
'src/language/json/types.ts',
11+
'src/language/xml/types.ts'
12+
]
13+
};

packages/eslint-plugin-fiori-tools/package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,18 @@
2626
"cross-env": "10.1.0",
2727
"eslint": "9.39.1",
2828
"@typescript-eslint/rule-tester": "8.57.2",
29-
"eslint-plugin-eslint-plugin": "7.3.2"
29+
"eslint-plugin-eslint-plugin": "7.3.2",
30+
"@types/semver": "7.7.1"
3031
},
3132
"dependencies": {
3233
"@babel/core": "7.29.0",
3334
"@babel/eslint-parser": "^7.28.5",
34-
"@eslint/js": "9.22.0",
35+
"@eslint/js": "10.0.1",
3536
"@eslint/json": "0.14.0",
36-
"@eslint/core": "0.17.0",
37+
"@eslint/core": "1.1.1",
3738
"@eslint/config-helpers": "0.5.3",
38-
"@typescript-eslint/eslint-plugin": ">=8.57.2",
39-
"@typescript-eslint/parser": ">=8.57.2",
39+
"@typescript-eslint/eslint-plugin": "8.57.2",
40+
"@typescript-eslint/parser": "8.57.2",
4041
"@sap-ux/fiori-annotation-api": "workspace:*",
4142
"@sap-ux/odata-annotation-core": "workspace:*",
4243
"@sap-ux/odata-vocabularies": "workspace:*",
@@ -46,7 +47,7 @@
4647
"@xml-tools/ast": "5.0.5",
4748
"@xml-tools/parser": "1.0.11",
4849
"@humanwhocodes/momoa": "^3.3.9",
49-
"@eslint/plugin-kit": "0.5.0",
50+
"@eslint/plugin-kit": "0.6.1",
5051
"globals": "17.4.0",
5152
"lodash": "4.18.1",
5253
"requireindex": "^1.2.0",
@@ -55,9 +56,8 @@
5556
"semver": "7.7.4"
5657
},
5758
"peerDependencies": {
58-
"eslint": "^9",
59-
"typescript-eslint": "^8.57.2",
60-
"@types/semver": "7.7.1"
59+
"eslint": "^9 || ^10",
60+
"typescript-eslint": "^8.57.2"
6161
},
6262
"engines": {
6363
"node": ">=20.x"

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ export const languages = {
4040
fiori: new FioriLanguage()
4141
};
4242

43+
const fioriRules = rules as Plugin['rules'];
44+
4345
/**
4446
* Default export following ESLint 9 plugin structure.
4547
* This is the recommended way to export plugins in ESLint 9.
@@ -52,7 +54,7 @@ const plugin: Plugin = {
5254
namespace: '@sap-ux/fiori-tools'
5355
},
5456
languages,
55-
rules: rules as Plugin['rules'],
57+
rules: fioriRules,
5658
processors: {}
5759
};
5860

@@ -493,7 +495,7 @@ export const configs: Record<string, Linter.Config[]> = {
493495
plugins: {
494496
'@sap-ux/fiori-tools': {
495497
meta,
496-
rules: rules as Plugin['rules']
498+
rules: fioriRules
497499
}
498500
}
499501
},
@@ -507,7 +509,7 @@ export const configs: Record<string, Linter.Config[]> = {
507509
'@sap-ux/fiori-tools': {
508510
meta,
509511
languages,
510-
rules: rules as Plugin['rules']
512+
rules: fioriRules
511513
}
512514
}
513515
},

0 commit comments

Comments
 (0)