@@ -16,18 +16,14 @@ import { data } from '../examples/examples.data.ts';
1616const configFileName = " eslint.config.js" ;
1717const packageJsonFileName = " package.json" ;
1818
19- const defaultConfig: string = ` import cds from '@sap/eslint-plugin-cds'
19+ const defaultConfig: string = ` import cds from '@sap/cds/eslint.config.mjs'
20+ import cdsPlugin from '@sap/eslint-plugin-cds'
2021
2122export default [
22- cds.configs.recommended,
23- {
24- plugins: {
25- '@sap/cds': cds
26- },
27- rules: {
28- // ...cds.configs.recommended.rules,
29- }
30- }
23+ ...cds.recommended,
24+ cdsPlugin.configs.js.all,
25+ cdsPlugin.configs.recommended,
26+ // %RULES%
3127]
3228`
3329
@@ -50,11 +46,11 @@ function link(name: Props['name'] = "", kind: Props['kind'], rules?: Props['rule
5046 rulesList .push (` "${key }": ${JSON .stringify (value )} ` );
5147 }
5248 sources [configFileName ] = defaultConfig .replace (
53- / \/\/ \s * ... cds . configs . recommended . rules, / ,
54- ` // ...cds.configs.recommended. rules, \n ${rulesList .join (' ,\n ' )}`
49+ / \/\/ %RULES% / ,
50+ ` { \n rules: { \n ${rulesList .join (' ,\n ' )} \n } \n }`
5551 );
5652 } else {
57- sources [configFileName ] = defaultConfig ;
53+ sources [configFileName ] = defaultConfig . replace ( / \/\/ %RULES% / , ' ' ) ;
5854 }
5955 if (packages ) {
6056 json = merge (defaultPackageJson , packages );
0 commit comments