Skip to content

Instantly share code, notes, and snippets.

@neet
Last active December 4, 2022 18:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neet/4e641b3ba7b9cf18b63f39ff907769f1 to your computer and use it in GitHub Desktop.
Save neet/4e641b3ba7b9cf18b63f39ff907769f1 to your computer and use it in GitHub Desktop.
Next.js ESLintプラグインの next と next/core-web-vitals の違い
{
"env": {
"browser": true,
"node": true
},
"globals": {},
"parser": "<PROJECT_DIR>/node_modules/eslint-config-next/parser.js",
"parserOptions": {
"requireConfigFile": false,
"sourceType": "module",
"allowImportExportEverywhere": true,
"babelOptions": {
"presets": ["next/babel"],
"caller": {
"supportsTopLevelAwait": true
}
},
"ecmaFeatures": {
"jsx": true
}
},
"plugins": ["react-hooks", "jsx-a11y", "react", "import", "@next/next"],
"rules": {
"@next/next/no-html-link-for-pages": ["error"],
"@next/next/no-sync-scripts": ["error"],
"@next/next/google-font-display": ["warn"],
"@next/next/google-font-preconnect": ["warn"],
"@next/next/next-script-for-ga": ["warn"],
"@next/next/no-before-interactive-script-outside-document": ["warn"],
"@next/next/no-css-tags": ["warn"],
"@next/next/no-head-element": ["warn"],
"@next/next/no-img-element": ["warn"],
"@next/next/no-page-custom-font": ["warn"],
"@next/next/no-styled-jsx-in-document": ["warn"],
"@next/next/no-title-in-document-head": ["warn"],
"@next/next/no-typos": ["warn"],
"@next/next/no-unwanted-polyfillio": ["warn"],
"@next/next/inline-script-id": ["error"],
"@next/next/no-assign-module-variable": ["error"],
"@next/next/no-document-import-in-page": ["error"],
"@next/next/no-duplicate-head": ["error"],
"@next/next/no-head-import-in-document": ["error"],
"@next/next/no-script-component-in-head": ["error"],
"import/no-anonymous-default-export": ["warn"],
"react/no-unknown-property": ["off"],
"react/react-in-jsx-scope": ["off"],
"react/prop-types": ["off"],
"jsx-a11y/alt-text": [
"warn",
{
"elements": ["img"],
"img": ["Image"]
}
],
"jsx-a11y/aria-props": ["warn"],
"jsx-a11y/aria-proptypes": ["warn"],
"jsx-a11y/aria-unsupported-elements": ["warn"],
"jsx-a11y/role-has-required-aria-props": ["warn"],
"jsx-a11y/role-supports-aria-props": ["warn"],
"react-hooks/rules-of-hooks": ["error"],
"react-hooks/exhaustive-deps": ["warn"],
"react/display-name": [2],
"react/jsx-key": [2],
"react/jsx-no-comment-textnodes": [2],
"react/jsx-no-duplicate-props": [2],
"react/jsx-no-target-blank": [2],
"react/jsx-no-undef": [2],
"react/jsx-uses-react": [2],
"react/jsx-uses-vars": [2],
"react/no-children-prop": [2],
"react/no-danger-with-children": [2],
"react/no-deprecated": [2],
"react/no-direct-mutation-state": [2],
"react/no-find-dom-node": [2],
"react/no-is-mounted": [2],
"react/no-render-return-value": [2],
"react/no-string-refs": [2],
"react/no-unescaped-entities": [2],
"react/no-unsafe": [0],
"react/require-render-return": [2]
},
"settings": {
"react": {
"version": "detect"
},
"import/parsers": {
"<PROJECT_DIR>/node_modules/@typescript-eslint/parser/dist/index.js": [
".ts",
".mts",
".cts",
".tsx",
".d.ts"
]
},
"import/resolver": {
"<PROJECT_DIR>/node_modules/eslint-import-resolver-node/index.js": {
"extensions": [".js", ".jsx", ".ts", ".tsx"]
},
"<PROJECT_DIR>/node_modules/eslint-import-resolver-typescript/lib/index.cjs": {
"alwaysTryTypes": true
}
}
},
"ignorePatterns": []
}
{
"env": {
"browser": true,
"node": true
},
"globals": {},
"parser": "<PROJECT_DIR>/node_modules/eslint-config-next/parser.js",
"parserOptions": {
"requireConfigFile": false,
"sourceType": "module",
"allowImportExportEverywhere": true,
"babelOptions": {
"presets": ["next/babel"],
"caller": {
"supportsTopLevelAwait": true
}
},
"ecmaFeatures": {
"jsx": true
}
},
"plugins": ["react-hooks", "@next/next", "jsx-a11y", "react", "import"],
"rules": {
"import/no-anonymous-default-export": ["warn"],
"react/no-unknown-property": ["off"],
"react/react-in-jsx-scope": ["off"],
"react/prop-types": ["off"],
"jsx-a11y/alt-text": [
"warn",
{
"elements": ["img"],
"img": ["Image"]
}
],
"jsx-a11y/aria-props": ["warn"],
"jsx-a11y/aria-proptypes": ["warn"],
"jsx-a11y/aria-unsupported-elements": ["warn"],
"jsx-a11y/role-has-required-aria-props": ["warn"],
"jsx-a11y/role-supports-aria-props": ["warn"],
"@next/next/google-font-display": ["warn"],
"@next/next/google-font-preconnect": ["warn"],
"@next/next/next-script-for-ga": ["warn"],
"@next/next/no-before-interactive-script-outside-document": ["warn"],
"@next/next/no-css-tags": ["warn"],
"@next/next/no-head-element": ["warn"],
"@next/next/no-html-link-for-pages": ["warn"],
"@next/next/no-img-element": ["warn"],
"@next/next/no-page-custom-font": ["warn"],
"@next/next/no-styled-jsx-in-document": ["warn"],
"@next/next/no-sync-scripts": ["warn"],
"@next/next/no-title-in-document-head": ["warn"],
"@next/next/no-typos": ["warn"],
"@next/next/no-unwanted-polyfillio": ["warn"],
"@next/next/inline-script-id": ["error"],
"@next/next/no-assign-module-variable": ["error"],
"@next/next/no-document-import-in-page": ["error"],
"@next/next/no-duplicate-head": ["error"],
"@next/next/no-head-import-in-document": ["error"],
"@next/next/no-script-component-in-head": ["error"],
"react-hooks/rules-of-hooks": ["error"],
"react-hooks/exhaustive-deps": ["warn"],
"react/display-name": [2],
"react/jsx-key": [2],
"react/jsx-no-comment-textnodes": [2],
"react/jsx-no-duplicate-props": [2],
"react/jsx-no-target-blank": [2],
"react/jsx-no-undef": [2],
"react/jsx-uses-react": [2],
"react/jsx-uses-vars": [2],
"react/no-children-prop": [2],
"react/no-danger-with-children": [2],
"react/no-deprecated": [2],
"react/no-direct-mutation-state": [2],
"react/no-find-dom-node": [2],
"react/no-is-mounted": [2],
"react/no-render-return-value": [2],
"react/no-string-refs": [2],
"react/no-unescaped-entities": [2],
"react/no-unsafe": [0],
"react/require-render-return": [2]
},
"settings": {
"react": {
"version": "detect"
},
"import/parsers": {
"<PROJECT_DIR>/node_modules/@typescript-eslint/parser/dist/index.js": [
".ts",
".mts",
".cts",
".tsx",
".d.ts"
]
},
"import/resolver": {
"<PROJECT_DIR>/node_modules/eslint-import-resolver-node/index.js": {
"extensions": [".js", ".jsx", ".ts", ".tsx"]
},
"<PROJECT_DIR>/node_modules/eslint-import-resolver-typescript/lib/index.cjs": {
"alwaysTryTypes": true
}
}
},
"ignorePatterns": []
}
@neet
Copy link
Author

neet commented Dec 4, 2022

やりかた

yarn run eslint --print-config ./.eslinrc.js

とやると、extends を解決したJSONを吐いてくれる。

違い

2つのdiffを https://www.jsondiff.com/ にて取ってみる。左がcore-web-vitalsで右が無印

image

これだけだった。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment