eslint-config-regiojet-next
Version:
Eslint Typescript rules for Next.js React projects
84 lines (64 loc) • 3.44 kB
JavaScript
// @ts-check
const config = [
{
name: '/next/best-practices',
rules: {
// Enforce font-display behavior with Google Fonts.
// https://nextjs.org/docs/messages/google-font-display
'/next/google-font-display': 'error',
// Ensure preconnect is used with Google Fonts.
// https://nextjs.org/docs/messages/google-font-preconnect
'/next/google-font-preconnect': 'error',
// Enforce id attribute on next/script components with inline content.
// https://nextjs.org/docs/messages/inline-script-id
'/next/inline-script-id': 'error',
// Prefer next/script component when using the inline script for Google Analytics.
// https://nextjs.org/docs/messages/next-script-for-ga
'/next/next-script-for-ga': 'error',
// Prevent assignment to the module variable.
// https://nextjs.org/docs/messages/no-assign-module-variable
'/next/no-assign-module-variable': 'error',
// Client components cannot be async functions.
// https://nextjs.org/docs/messages/no-async-client-component
'/next/no-async-client-component': 'error',
// Prevent usage of next/script's beforeInteractive strategy outside of app/layout.jsx or pages/_document.js.
// https://nextjs.org/docs/messages/no-before-interactive-script-outside-document
'/next/no-before-interactive-script-outside-document': 'warn',
// Prevent manual stylesheet tags.
// https://nextjs.org/docs/messages/no-css-tags
'/next/no-css-tags': 'error',
// Prevent importing next/document outside of pages/_document.js.
// https://nextjs.org/docs/messages/no-document-import-in-page
'/next/no-document-import-in-page': 'error',
// Prevent duplicate usage of <Head> in pages/_document.js
// https://nextjs.org/docs/messages/no-duplicate-head
'/next/no-duplicate-head': 'error',
// Prevent usage of <head> element.
// https://nextjs.org/docs/messages/no-head-element
'/next/no-head-element': 'error',
// Prevent usage of next/head in pages/_document.js.
// https://nextjs.org/docs/messages/no-head-import-in-document
'/next/no-head-import-in-document': 'error',
// Prevent usage of <img> element due to slower LCP and higher bandwidth.
// https://nextjs.org/docs/messages/no-img-element
'/next/no-img-element': 'warn',
// Prevent page-only custom fonts.
// https://nextjs.org/docs/messages/no-page-custom-font
'/next/no-page-custom-font': 'error',
// Prevent usage of next/script in next/head component.
// https://nextjs.org/docs/messages/no-script-component-in-head
'/next/no-script-component-in-head': 'error',
// Prevent usage of styled-jsx in pages/_document.js.
// https://nextjs.org/docs/messages/no-styled-jsx-in-document
'/next/no-styled-jsx-in-document': 'error',
// Prevent usage of <title> with Head component from next/document.
// https://nextjs.org/docs/messages/no-title-in-document-head
'/next/no-title-in-document-head': 'error',
'/next/no-typos': 'warn',
// Prevent duplicate polyfills from Polyfill.io.
// https://nextjs.org/docs/messages/no-unwanted-polyfillio
'/next/no-unwanted-polyfillio': 'error',
},
},
];
export default config;