Skip to content

Commit

Permalink
use shared config (local package atm)
Browse files Browse the repository at this point in the history
  • Loading branch information
sergei-maertens committed Jan 4, 2025
1 parent e4aa17f commit b67b7b4
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 90 deletions.
91 changes: 6 additions & 85 deletions frontend/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,94 +1,15 @@
import eslint 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 storybook from "eslint-plugin-storybook";
import globals from "globals";
import tseslint from "typescript-eslint";
import { ignoreBuildArtifacts } from "@maykinmedia/eslint-config";
import recommended from "@maykinmedia/eslint-config/recommended";

const config = [
ignoreBuildArtifacts(["build", "storybook-static"]),
...recommended,
{
name: "project:ignore build artifacts",
ignores: ["build/**/*", "storybook-static/**/*"],
},
{
name: "project:environment",
settings: {
react: {
version: "detect",
},
},
languageOptions: {
globals: {
...globals.builtin,
...globals.browser,
},
},
},
// Standard JS rules
eslint.configs.recommended,
// eslint-disable-next-line import/no-named-as-default-member
...tseslint.configs.recommended,
// Import/export linting
{
settings: {
"import/resolver": {
node: true,
typescript: true,
},
},
...importPlugin.flatConfigs.recommended,
languageOptions: {
...importPlugin.flatConfigs.recommended.languageOptions,
ecmaVersion: "latest",
},
name: "project:react-hooks:disable-exhaustive-deps",
rules: {
...importPlugin.flatConfigs.recommended.rules,
"import/first": "error",
"import/no-amd": "error",
"import/no-anonymous-default-export": "warn",
"import/no-webpack-loader-syntax": "error",
},
},
importPlugin.flatConfigs.typescript,
// React-specific linting
jsxA11y.flatConfigs.recommended,
{
name: "react/recommended",
...reactPlugin.configs.flat.recommended,
},
{
name: "react/jsx-runtime",
...reactPlugin.configs.flat["jsx-runtime"],
},
{
name: "prettier/recommended",
...prettierRecommended,
},
// Storybook stories
...storybook.configs["flat/recommended"],
{
name: "project:storybook:check-config",
ignores: ["!.storybook"],
},
{
name: "project:storybook:test-runner",
files: [".storybook/test-runner-jest.js"],
languageOptions: {
globals: globals.commonjs,
"react-hooks/exhaustive-deps": "off",
},
},
// // Unit tests
// {
// files: ["**/*.spec.{js,jsx}", "src/vitest.setup.mjs"],
// languageOptions: {
// globals: {
// ...globals.browser,
// ...globals.vitest,
// },
// },
// },
];

export default config;
55 changes: 50 additions & 5 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
},
"devDependencies": {
"@chromatic-com/storybook": "^1.3.3",
"@maykinmedia/eslint-config": "file:../../maykin-eslint-config/maykinmedia-eslint-config-0.1.0.tgz",
"@playwright/test": "^1.48.0",
"@storybook/addon-coverage": "^1.0.4",
"@storybook/addon-essentials": "^8.0.10",
Expand All @@ -73,6 +74,7 @@
"eslint-plugin-jsx-a11y": "^6.10.2",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.37.3",
"eslint-plugin-react-hooks": "^5.1.0",
"eslint-plugin-storybook": "^0.11.2",
"globals": "^15.14.0",
"husky": "^9.0.11",
Expand Down

0 comments on commit b67b7b4

Please sign in to comment.