42 lines
1.2 KiB
JavaScript
42 lines
1.2 KiB
JavaScript
import { defineConfig, globalIgnores } from "eslint/config";
|
|
import nextVitals from "eslint-config-next/core-web-vitals";
|
|
import nextTs from "eslint-config-next/typescript";
|
|
|
|
const eslintConfig = defineConfig([
|
|
...nextVitals,
|
|
...nextTs,
|
|
{
|
|
files: ['**/*.{js,mjs,cjs,ts,tsx}'],
|
|
ignores: ['lib/http-client.ts', 'lib/outbound-proxy.ts'],
|
|
rules: {
|
|
'no-restricted-imports': ['error', {
|
|
patterns: [{
|
|
group: ['axios', 'axios/*'],
|
|
message: 'Import Axios from @/lib/http-client so requests keep the saved user agent, proxy and timeout.',
|
|
}],
|
|
}],
|
|
'no-restricted-modules': ['error', {
|
|
paths: [{
|
|
name: 'axios',
|
|
message: 'Use @/lib/http-client for the configured Axios client.',
|
|
}],
|
|
patterns: ['axios/*'],
|
|
}],
|
|
'no-restricted-syntax': ['error', {
|
|
selector: 'ImportExpression[source.value=/^axios(\\/|$)/]',
|
|
message: 'Import @/lib/http-client for the configured Axios client.',
|
|
}],
|
|
},
|
|
},
|
|
// Override default ignores of eslint-config-next.
|
|
globalIgnores([
|
|
// Default ignores of eslint-config-next:
|
|
".next/**",
|
|
"out/**",
|
|
"build/**",
|
|
"next-env.d.ts",
|
|
]),
|
|
]);
|
|
|
|
export default eslintConfig;
|