-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
df0447a
commit ff7bf73
Showing
11 changed files
with
320 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,70 @@ | ||
module.exports = { | ||
extends: [require.resolve("./core.js"), "next/core-web-vitals", "plugin:react/jsx-runtime"], | ||
rules: { | ||
"react/display-name": "off", | ||
"react/jsx-curly-brace-presence": "error", | ||
"react/prop-types": "off", | ||
"react/self-closing-comp": "error", | ||
"react/jsx-no-useless-fragment": ["error", { allowExpressions: true }], | ||
"@comet/no-private-sibling-import": ["error", ["gql", "sc", "gql.generated"]], | ||
"no-restricted-imports": [ | ||
"error", | ||
{ | ||
paths: [ | ||
{ | ||
name: "react", | ||
importNames: ["default"], | ||
}, | ||
{ | ||
name: "next/image", | ||
importNames: ["default"], | ||
message: "Please use Image from @comet/cms-site instead", | ||
}, | ||
], | ||
import coreConfig from "./core.js"; | ||
import react from "eslint-plugin-react"; | ||
import globals from "globals"; | ||
import { FlatCompat } from "@eslint/eslintrc"; | ||
|
||
const compat = new FlatCompat({ | ||
// import.meta.dirname is available after Node.js v20.11.0 | ||
baseDirectory: import.meta.dirname, | ||
}); | ||
|
||
const nextCoreWebVitals = compat | ||
.config({ | ||
extends: ["next/core-web-vitals"], | ||
}) | ||
// We need to filter out configurations from nextCoreWebVitals which define plugin.import. It is conflicting | ||
// because it gets redefined | ||
.filter((config) => !config.plugins || !config.plugins.import); | ||
|
||
/** @type {import('eslint')} */ | ||
const config = [ | ||
...coreConfig, | ||
// NextJJS does not support eslint v9 flat config yet - na opt-in to compatibility mode is required | ||
...nextCoreWebVitals, | ||
{ | ||
rules: { | ||
"@comet/no-private-sibling-import": ["error", ["gql", "sc", "gql.generated"]], | ||
"no-restricted-imports": [ | ||
"error", | ||
{ | ||
paths: [ | ||
{ | ||
name: "react", | ||
importNames: ["default"], | ||
}, | ||
{ | ||
name: "next/image", | ||
importNames: ["default"], | ||
message: "Please use Image from @comet/cms-site instead", | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
}, | ||
{ | ||
languageOptions: { | ||
parserOptions: { | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
}, | ||
globals: { | ||
...globals.browser, | ||
}, | ||
], | ||
}, | ||
plugins: { | ||
react: react, | ||
}, | ||
rules: { | ||
"react/display-name": "off", | ||
"react/jsx-curly-brace-presence": "error", | ||
"react/prop-types": "off", | ||
"react/self-closing-comp": "error", | ||
"react/jsx-no-useless-fragment": ["error", { allowExpressions: true }], | ||
"react/react-in-jsx-scope": "off", | ||
}, | ||
}, | ||
}; | ||
]; | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import cometConfig from "@comet/eslint-config/nextjs.js"; | ||
|
||
/** @type {import('eslint')} */ | ||
const config = [ | ||
{ | ||
ignores: ["src/*.generated.ts", "lib/**", "**/*.generated.ts"], | ||
}, | ||
...cometConfig, | ||
{ | ||
rules: { | ||
"@next/next/no-html-link-for-pages": "off", // disabled because lib has no pages dir | ||
"@comet/no-other-module-relative-import": "off", | ||
}, | ||
}, | ||
]; | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.