Skip to content

Commit

Permalink
chore: create base eslint config
Browse files Browse the repository at this point in the history
  • Loading branch information
araujogui committed Sep 23, 2024
1 parent b26f16e commit 767fc0e
Show file tree
Hide file tree
Showing 7 changed files with 530 additions and 679 deletions.
62 changes: 6 additions & 56 deletions apps/site/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { FlatCompat } from '@eslint/eslintrc';
import js from '@eslint/js';
import importX from 'eslint-plugin-import-x';
import * as mdx from 'eslint-plugin-mdx';
import noRelativeImportPaths from 'eslint-plugin-no-relative-import-paths';
import react from 'eslint-plugin-react';
import storybook from 'eslint-plugin-storybook';
import tseslint from 'typescript-eslint';

// eslint-disable-next-line no-relative-import-paths/no-relative-import-paths
import baseConfig from '../../eslint.config.js';

const compat = new FlatCompat();

const compatConfig = compat.config({
Expand All @@ -20,62 +20,12 @@ const compatConfig = compat.config({
});

export default tseslint.config(
...baseConfig,
{
ignores: [
'node_modules',
'.next',
'.swc',
'.turbo',
'build',
'coverage',
'global.d.ts',
'junit.xml',
'storybook-static/**',
],
},
{
extends: [
js.configs.recommended,
importX.flatConfigs.recommended,
importX.flatConfigs.typescript,
react.configs.flat['jsx-runtime'],
...tseslint.configs.recommended,
...compatConfig,
],
extends: [react.configs.flat['jsx-runtime'], ...compatConfig],
files: ['**/*.{js,md,mdx,mjs,ts,tsx}'],
plugins: {
'no-relative-import-paths': noRelativeImportPaths,
},
rules: {
'@next/next/no-duplicate-head': 'off',
'@typescript-eslint/array-type': ['error', { default: 'generic' }],
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/no-require-imports': 'off',
'import-x/namespace': 'off',
'import-x/no-named-as-default-member': 'off',
'import-x/no-unresolved': 'off',
'import-x/order': [
'error',
{
groups: [
'builtin',
'external',
'internal',
['sibling', 'parent'],
'index',
'unknown',
],
'newlines-between': 'always',
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
},
],
'no-relative-import-paths/no-relative-import-paths': [
'warn',
{ allowSameFolder: true, prefix: '@' },
],
},
settings: {
react: {
Expand All @@ -98,7 +48,7 @@ export default tseslint.config(
{
files: ['**/*.{mdx,tsx}'],
rules: {
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
// '@typescript-eslint/consistent-type-definitions': ['error', 'type'],
'react/no-unescaped-entities': 'off',
'react/function-component-definition': [
'error',
Expand Down
5 changes: 0 additions & 5 deletions apps/site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,8 @@
"@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
"@types/semver": "~7.5.8",
"eslint": "~9.10.0",
"eslint-config-next": "~14.2.11",
"eslint-import-resolver-typescript": "~3.6.3",
"eslint-plugin-import-x": "~4.2.1",
"eslint-plugin-mdx": "~3.1.5",
"eslint-plugin-no-relative-import-paths": "~1.5.5",
"eslint-plugin-react": "~7.36.1",
"eslint-plugin-react-hooks": "5.1.0-rc-4c58fce7-20240904",
"eslint-plugin-storybook": "0.9.0--canary.156.26b630a.0",
Expand All @@ -124,7 +120,6 @@
"stylelint-order": "6.0.4",
"stylelint-selector-bem-pattern": "4.0.1",
"typescript": "~5.5.4",
"typescript-eslint": "~8.5.0",
"user-agent-data-types": "0.4.2"
}
}
61 changes: 61 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import js from '@eslint/js';
import importX from 'eslint-plugin-import-x';
import noRelativeImportPaths from 'eslint-plugin-no-relative-import-paths';
import tseslint from 'typescript-eslint';

export default tseslint.config(
{
ignores: [
'node_modules',
'.turbo',
'.next',
'build',
'coverage',
'global.d.ts',
'junit.xml',
'storybook-static/**',
],
},
{
extends: [
js.configs.recommended,
importX.flatConfigs.recommended,
importX.flatConfigs.typescript,
...tseslint.configs.recommended,
],
files: ['**/*.{js,mjs,ts,tsx}'],
plugins: {
'no-relative-import-paths': noRelativeImportPaths,
},
rules: {
'@typescript-eslint/array-type': ['error', { default: 'generic' }],
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/no-require-imports': 'off',
'import-x/namespace': 'off',
'import-x/no-named-as-default-member': 'off',
'import-x/no-unresolved': 'off',
'import-x/order': [
'error',
{
groups: [
'builtin',
'external',
'internal',
['sibling', 'parent'],
'index',
'unknown',
],
'newlines-between': 'always',
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
},
],
'no-relative-import-paths/no-relative-import-paths': [
'warn',
{ allowSameFolder: true, prefix: '@' },
],
},
}
);
Loading

0 comments on commit 767fc0e

Please sign in to comment.