ESLint `import/no-named-export` how to enable with exceptions

583 Views Asked by At

I have named exports disabled in NextJS' pages/ and (now) app/ folders. If it is relevant. I have a root config that disabled default exports for the entire application. Then those two folders have an .eslintrc to override and flip the relevant rules.

Root .eslintrc rules

{
  "root": true,
  "rules": {
    "import/no-default-export": "error",
    "import/prefer-default-export": "off",
    "import/no-named-export": "off"
  }
}

app/ and pages/ .eslintrc rules

{
  "ignorePatterns": ["middleware.ts", "./**/middleware.ts"],
  "rules": {
    "import/no-default-export": "off",
    "import/prefer-default-export": "error",
    "import/no-named-export": "error"
  },
  "root": false
}

Is there a way to create an exception for their known valid exports? i.e. getServerSideProps

0

There are 0 best solutions below