Skip to content

Commit

Permalink
🧑‍💻 Use maykin shared config
Browse files Browse the repository at this point in the history
  • Loading branch information
sergei-maertens committed Jan 6, 2025
1 parent b01719c commit 13b7d3e
Show file tree
Hide file tree
Showing 3 changed files with 930 additions and 129 deletions.
79 changes: 6 additions & 73 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,83 +1,16 @@
import pluginJs from '@eslint/js';
import importPlugin from 'eslint-plugin-import';
import jsxA11y from 'eslint-plugin-jsx-a11y';
import prettierRecommended from 'eslint-plugin-prettier/recommended';
import reactPlugin from 'eslint-plugin-react';
import hooksPlugin from 'eslint-plugin-react-hooks';
import globals from 'globals';
import { ignoreBuildArtifacts } from "@maykinmedia/eslint-config";
import recommended from "@maykinmedia/eslint-config/recommended";

const config = [
ignoreBuildArtifacts(["dist", "dist-vite", "storybook-static"]),
...recommended,
{
files: ['**/*.{js,mjs,cjs,jsx,ts,tsx}'],
settings: {
react: {
version: 'detect',
},
},
languageOptions: {
globals: {
...globals.builtin,
...globals.browser,
},
},
},
// Standard JS rules
pluginJs.configs.recommended,
// Import/export linting
{
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.mjs', '.json'],
moduleDirectory: ['src', 'node_modules'],
},
},
},
...importPlugin.flatConfigs.recommended,
languageOptions: {
...importPlugin.flatConfigs.recommended.languageOptions,
ecmaVersion: 'latest',
sourceType: 'module',
},
rules: {
...importPlugin.flatConfigs.recommended.rules,
'import/first': 'error',
'import/no-amd': 'error',
'import/no-anonymous-default-export': 'warn',
'import/no-webpack-loader-syntax': 'error',
},
},
// React-specific linting
jsxA11y.flatConfigs.recommended,
{
...reactPlugin.configs.flat.recommended,
name: 'project/overrides',
rules: {
...reactPlugin.configs.flat.recommended.rules,
'react/jsx-uses-vars': 'warn',
'react/jsx-uses-react': 'warn',
// required for react-intl
'react/style-prop-object': [
'error',
{
allow: ['FormattedNumber', 'FormattedDateParts', 'FormattedRelativeTime'],
},
],
// normally this would be on, but we'll rather migrate to typescript
'react/prop-types': 'off',
},
},
reactPlugin.configs.flat['jsx-runtime'],
{
plugins: {'react-hooks': hooksPlugin},
rules: hooksPlugin.configs.recommended.rules,
},
prettierRecommended,
// Storybook stories
{
files: ['**/*.stories.{js,jsx}'],
rules: {
'import/no-anonymous-default-export': 'off',
},
}
},
// Unit tests
{
Expand Down
Loading

0 comments on commit 13b7d3e

Please sign in to comment.