Repository: eslint/eslint
File: messages/eslintrc-incompat.js (JavaScript)

Code before:
"use strict";

/* eslint consistent-return: 0 -- no default case */

module.exports = function({ key }) {

    switch (key) {
        case "env":
            return `
A config object is using the "env" key, which is not supported in flat config system.

Flat config uses "languageOptions.globals" to define global variables for your files.

Please see the following page for information on how to convert your config object into the correct format:
https://eslint.org/docs/latest/use/configure/migration-guide#configuring-language-options
            `.trim();

        case "extends":
            return `
A config object is using the "extends" key, which is not supported in flat config system.

Instead of "extends", you can include config objects that you'd like to extend from directly in the flat config array.

Please see the following page for more information:
https://eslint.org/docs/latest/use/configure/configuration-files-new#using-predefined-configurations
            `.trim();

        case "globals":

            return `

Review comment (suggestion):
Would this look slightly nicer as an object rather than a big switch? A little less syntax noise to my eyes :smile:

e.g.
```
const keyErrors = {
    env: `
A config object is using the "env" key, which is not supported in flat config system.

Flat config uses "languageOptions.globals" to define global variables for your files.

Please see the following page for information on how to convert your config object into the correct format:
https://eslint.org/docs/latest/use/configure/migration-guide#configuring-language-options
`,

    extends: `
A config object is using the "extends" key, which is not supported in flat config system.

Instead of "extends", you can include config objects that you'd like to extend from directly in the flat config array.

Please see the following page for more information:
https://eslint.org/docs/latest/use/configure/configuration-files-new#using-predefined-configurations
`,

...

};

module.exports = key => keyErrors[key].trim();
```

Code after:
"use strict";

/* eslint consistent-return: 0 -- no default case */

const messages = {

    env: `
A config object is using the "env" key, which is not supported in flat config system.

Flat config uses "languageOptions.globals" to define global variables for your files.

Please see the following page for information on how to convert your config object into the correct format:
https://eslint.org/docs/latest/use/configure/migration-guide#configuring-language-options
`,

    extends: `
A config object is using the "extends" key, which is not supported in flat config system.

Instead of "extends", you can include config objects that you'd like to extend from directly in the flat config array.

Please see the following page for more information:
https://eslint.org/docs/latest/use/configure/migration-guide#predefined-configs
`,

    globals: `
A config object is using the "globals" key, which is not supported in flat config system.

Flat config uses "languageOptions.globals" to define global variables for your files.

Please see the following page for information on how to convert your config object into the correct format: