101 lines
3.2 KiB
JSON
101 lines
3.2 KiB
JSON
{
|
|
"root": true,
|
|
"plugins": ["file-progress"],
|
|
"overrides": [
|
|
{
|
|
// All files.
|
|
"files": ["*.ts", "*.tsx", "*.cjs"],
|
|
"extends": [
|
|
"airbnb",
|
|
"plugin:eslint-comments/recommended",
|
|
"plugin:storybook/recommended",
|
|
"plugin:prettier/recommended" // This config needs to be the last one as it overrides rules from other configs.
|
|
],
|
|
"rules": {
|
|
// We prefer named exports as they ensure that import name is the same as the export name.
|
|
"import/prefer-default-export": 0,
|
|
"import/no-default-export": 2,
|
|
|
|
// Shows information about currently processing file in the console.
|
|
"file-progress/activate": 1,
|
|
|
|
// Removes eslint-disable comments when they are not needed.
|
|
"eslint-comments/no-unused-disable": 2,
|
|
|
|
// Ensure each eslint-disable has a description comment.
|
|
"eslint-comments/require-description": [2, { "ignore": ["eslint-enable"] }]
|
|
}
|
|
},
|
|
{
|
|
// TypeScript files.
|
|
"files": ["*.ts", "*.tsx"],
|
|
"plugins": ["simple-import-sort"],
|
|
"extends": [
|
|
"airbnb-typescript",
|
|
"plugin:@typescript-eslint/recommended",
|
|
"plugin:@typescript-eslint/recommended-requiring-type-checking",
|
|
"plugin:prettier/recommended"
|
|
],
|
|
"parserOptions": {
|
|
"project": "./tsconfig.eslint.json"
|
|
},
|
|
"settings": {
|
|
"import/resolver": {
|
|
"typescript": { "project": "./tsconfig.eslint.json" }
|
|
}
|
|
},
|
|
"rules": {
|
|
// We can create an empty interface only when it extends other interface.
|
|
"@typescript-eslint/no-empty-interface": [2, { "allowSingleExtends": true }],
|
|
|
|
// Rules for imports and exports order.
|
|
"simple-import-sort/imports": [
|
|
2,
|
|
{
|
|
"groups": [
|
|
["^\\u0000"], // Side effects
|
|
["^@?\\w"], // Packages
|
|
["^"], // Absolute imports
|
|
["^\\."] // Relative imports
|
|
]
|
|
}
|
|
],
|
|
"simple-import-sort/exports": 2
|
|
}
|
|
},
|
|
{
|
|
// Files with React components.
|
|
"files": ["*.tsx"],
|
|
"extends": ["airbnb/hooks", "plugin:react/jsx-runtime", "plugin:prettier/recommended"],
|
|
"rules": {
|
|
// Write all components as arrow functions.
|
|
"react/function-component-definition": [
|
|
2,
|
|
{ "namedComponents": "arrow-function", "unnamedComponents": "arrow-function" }
|
|
],
|
|
|
|
// We use props spreading to pass props to the html elements under custom components.
|
|
"react/jsx-props-no-spreading": 0,
|
|
|
|
// Define values for optional props as by providing default arguments.
|
|
"react/require-default-props": [2, { "functions": "defaultArguments" }]
|
|
}
|
|
},
|
|
{
|
|
// Storybook stories
|
|
"files": ["*.stories.tsx"],
|
|
"rules": {
|
|
"import/no-default-export": 0
|
|
}
|
|
},
|
|
{
|
|
// Configuration files
|
|
"files": ["astro.config.ts", "tailwind.config.cjs", ".storybook/*"],
|
|
"rules": {
|
|
"import/no-default-export": 0,
|
|
"import/no-extraneous-dependencies": [2, { "devDependencies": true }]
|
|
}
|
|
}
|
|
],
|
|
"ignorePatterns": ["!.storybook"]
|
|
}
|