The Node.js® Website
1{
2 "extends": "prettier",
3 "overrides": [
4 {
5 "files": ["public/**/*.js"],
6 "env": { "browser": true }
7 },
8 {
9 "files": ["components/**/*.stories.tsx"],
10 "extends": "plugin:storybook/recommended"
11 },
12 {
13 "files": ["**/{__tests__,__mocks__}/*.mjs"],
14 "env": { "jest": true }
15 },
16 {
17 "files": ["**/*.{js,mjs,ts,tsx,mdx}"],
18 "env": { "es6": true, "node": true },
19 "plugins": ["import"],
20 "extends": ["eslint:recommended", "next", "next/core-web-vitals"],
21 "rules": {
22 "import/order": [
23 "error",
24 {
25 "groups": [
26 "builtin",
27 "external",
28 "internal",
29 ["sibling", "parent"],
30 "index",
31 "unknown"
32 ],
33 "newlines-between": "always",
34 "alphabetize": {
35 "order": "asc",
36 "caseInsensitive": true
37 }
38 }
39 ]
40 }
41 },
42 {
43 "files": ["**/*.ts?(x)"],
44 "plugins": ["@typescript-eslint", "no-relative-import-paths"],
45 "extends": [
46 "plugin:@typescript-eslint/recommended",
47 "plugin:import/recommended",
48 "plugin:import/typescript"
49 ],
50 "parser": "@typescript-eslint/parser",
51 "rules": {
52 "@typescript-eslint/consistent-type-imports": "error",
53 "@typescript-eslint/array-type": ["error", { "default": "generic" }],
54 "no-relative-import-paths/no-relative-import-paths": [
55 "warn",
56 { "allowSameFolder": true, "prefix": "@" }
57 ]
58 }
59 },
60 {
61 "files": ["**/*.md?(x)"],
62 "extends": "plugin:mdx/recommended",
63 "rules": {
64 "react/jsx-no-undef": "off",
65 "@next/next/no-img-element": "off"
66 }
67 },
68 {
69 "files": ["**/*.{mdx,tsx}"],
70 "rules": {
71 "@typescript-eslint/consistent-type-definitions": ["error", "type"],
72 "react/no-unescaped-entities": "off",
73 "react/function-component-definition": [
74 "error",
75 {
76 "namedComponents": "arrow-function",
77 "unnamedComponents": "arrow-function"
78 }
79 ],
80 "no-restricted-syntax": [
81 "error",
82 {
83 "selector": "ImportDeclaration[source.value='react'][specifiers.0.type='ImportDefaultSpecifier']",
84 "message": "Default React import not allowed since we use the TypeScript jsx-transform. If you need a global type that collides with a React named export (such as `MouseEvent`), try using `globalThis.MouseHandler`"
85 },
86 {
87 "selector": "ImportDeclaration[source.value='react'] :matches(ImportNamespaceSpecifier)",
88 "message": "Named * React import is not allowed. Please import what you need from React with Named Imports"
89 }
90 ]
91 }
92 }
93 ]
94}