0
respostas

Erro ao executar npx eslint .\script.js

Quando executo o comando npx eslint .\script.js me retorna o erro abaixo

Oops! Something went wrong! :(

ESLint: 9.39.2

ESLint couldn't find an eslint.config.(js|mjs|cjs) file.

From ESLint v9.0.0, the default configuration file is now eslint.config.js.   
If you are using a .eslintrc.* file, please follow the migration guide        
to update your configuration file to the new format:

https://eslint.org/docs/latest/use/configure/migration-guide

If you still have problems after following the migration guide, please stop by
https://eslint.org/chat/help to chat with the team.

Em outro forum vi que a partir da versao 9, tenho que criar um arquivo eslint.config.js

export default [
  {
    files: ["**/*.js"],
    languageOptions: {
      ecmaVersion: "latest",
      sourceType: "module",
    },
    rules: {
      semi: "error",
      quotes: ["error", "double"],
    },
  },
];

E comecou a retornar esse erro

(node:28312) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)

Oops! Something went wrong! :(

ESLint: 9.39.2

C:\Users\Vinicius\Documents\ESTUDO\organizado\alura\formacao-angular-crie-aplicacoes-web-ageis\05-node-js-terminal-ambiente-desenvolvimento-front-end\3519-nodejs-vidflow-projeto-base\eslint.config.js:1
export default [
^^^^^^

SyntaxError: Unexpected token 'export'
    at Object.compileFunction (node:vm:360:18)
    at wrapSafe (node:internal/modules/cjs/loader:1126:15)
    at Module._compile (node:internal/modules/cjs/loader:1162:27)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10)
    at Module.load (node:internal/modules/cjs/loader:1076:32)
    at Function.Module._load (node:internal/modules/cjs/loader:911:12)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:169:29)
    at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:530:24)

Por favor, pode ajudar?