@tpzdsp/eslint-config-dsp
Version:
re-usable config for ESLint, Prettier and semantic-release
32 lines (29 loc) • 1.14 kB
JavaScript
import nextPlugin from '@next/eslint-plugin-next';
import baseConfig, { NO_RESTRICTED_STYNAX_CONFIG } from './index.js';
export default [
...baseConfig,
{
name: 'nextjs',
files: ['**/*.js', '**/*.ts', '**/*.jsx', '**/*.tsx'],
plugins: { '@next/next': nextPlugin },
rules: {
...nextPlugin.configs.recommended.rules,
...nextPlugin.configs['core-web-vitals'].rules,
'no-restricted-syntax': [
'error',
...NO_RESTRICTED_STYNAX_CONFIG,
{
selector: "JSXOpeningElement[name.name='Image'] JSXAttribute[name.name='src'] Literal",
message:
'Use local images instead of directly referencing the image path. https://nextjs.org/docs/app/getting-started/images-and-fonts#local-images',
},
{
selector:
"JSXOpeningElement[name.name='Image'] JSXAttribute[name.name='src'] JSXExpressionContainer > TemplateLiteral",
message:
'Use local images instead of directly referencing the image path. https://nextjs.org/docs/app/getting-started/images-and-fonts#local-images',
},
],
},
},
];