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 Oct 18, 2024
1 parent 851b085 commit 17c883d
Show file tree
Hide file tree
Showing 7 changed files with 3,889 additions and 5,886 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
3 changes: 0 additions & 3 deletions apps/site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,9 @@
"@types/react": "^18.3.11",
"@types/react-dom": "^18.3.0",
"@types/semver": "~7.5.8",
"eslint": "~9.10.0",
"eslint-config-next": "~14.2.14",
"eslint-import-resolver-typescript": "~3.6.3",
"eslint-plugin-import-x": "~4.3.1",
"eslint-plugin-mdx": "~3.1.5",
"eslint-plugin-no-relative-import-paths": "~1.5.5",
"eslint-plugin-react": "~7.37.1",
"eslint-plugin-react-hooks": "5.1.0-rc.0",
"eslint-plugin-storybook": "0.9.0--canary.156.26b630a.0",
Expand Down
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 17c883d

Please sign in to comment.