close

Filter

loading table of contents...

CoreMedia Content Cloud v13 Upgrade Guide / Version 2512.0

Table Of Contents

7.10.4 Upgraded eslint to Version v9

Eslint was upgraded to v9. As this involves changing to the new flat config, we decided to provide two functions, which help to set up the config for the corresponding package type:

  • createFrontendEslintConfig: per default lints "src" and "test" folders with standard rules

  • createFrontendToolsEslintConfig : per default lints "src" and "test" folders with standard rules and adds additional globals for node

The following steps are necessary for packages using eslint:

  1. package.json: Remove the file pattern from the eslint script.

  2. eslint.config.(m)js: Create the eslint.config.mjs file. You can also create a eslint.config.js if the package is already ESM package.

    Write the following content into the file, using the corresponding eslint-config package

    import { createFrontendEslintConfig } from "@coremedia/eslint-config-frontend";
    
              export default createFrontendEslintConfig();

    For more fine granular control over folders that should be linted you can utilize the options parameter of createEslintConfig, for example:

    import { createFrontendEslintConfig } from "@coremedia/eslint-config-frontend";
    
    export default createFrontendEslintConfig({ sourceFolders: ["src", "my-src"] });
  3. .elsintrc: In case you do not have made any adjustments you can delete the .eslintrc file. Otherwise, you need to migrate the changes to v9 (Migrate to v9.x - ESLINT ) and add them to the eslint.config.(m)js file which can be done like this:

    import { createEslintConfig } from "@coremedia/studio-client.eslint-config";
    import { defineConfig, globalIgnores } from "eslint/config";
    
    export default defineConfig([
      createEslintConfig(),
      {
        // your custom eslint config
      },
    ]);
  4. Run the linter and fix reported problems.

As this is a major upgrade of the standard eslint, some rules sets have been added or changed.

CoreMedia's goal was to find the balance between avoiding major breaking changes for the code base but still benefiting from these improvements, so we adjusted the rules if necessary. However, there might still might be some newly reported problems to fix.

Search Results

Table Of Contents
warning

Your Internet Explorer is no longer supported.

Please use Mozilla Firefox, Google Chrome, or Microsoft Edge.