Skip to content

Commit

Permalink
Moved all eslint config to package
Browse files Browse the repository at this point in the history
  • Loading branch information
robknight committed Sep 8, 2024
1 parent b57033f commit 6a8d022
Show file tree
Hide file tree
Showing 14 changed files with 175 additions and 205 deletions.
4 changes: 4 additions & 0 deletions apps/client-web/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import reactInternal from "@parcnet/eslint-config/eslint.reactInternal.config.mjs";

/** @type {import("eslint").Linter.Config[]} */
export default [...reactInternal];
6 changes: 3 additions & 3 deletions apps/client-web/postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
autoprefixer: {}
}
};
13 changes: 5 additions & 8 deletions apps/client-web/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
/** @type {import('tailwindcss').Config} */
export default {
content: [
"./index.html",
"./src/**/*.{js,ts,jsx,tsx}",
], theme: {
extend: {},
content: ["./index.html", "./src/**/*.{js,ts,jsx,tsx}"],
theme: {
extend: {}
},
plugins: [],
}

plugins: []
};
51 changes: 3 additions & 48 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,49 +1,4 @@
import eslint from "@eslint/js";
import tseslint from "typescript-eslint";
import pluginChaiFriendly from "eslint-plugin-chai-friendly";
import hooksPlugin from "eslint-plugin-react-hooks";
import base from "@parcnet/eslint-config/eslint.base.config.mjs";

export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
...tseslint.configs.stylistic,
{
ignores: ["**/node_modules/*", "**/dist/"] // global ignore with single ignore key
},
{
languageOptions: {
parserOptions: {
project: false,
tsconfigRootDir: import.meta.dirname
}
},
files: ["src/**/*.{ts,tsx}"]
},
{
plugins: {
"chai-friendly": pluginChaiFriendly,
"react-hooks": hooksPlugin
},
rules: hooksPlugin.configs.recommended.rules
},
{
rules: {
"@typescript-eslint/no-unused-expressions": "off",
"chai-friendly/no-unused-expressions": "error",
"@typescript-eslint/consistent-type-definitions": "off",
// enable underscore ignore pattern for unused vars
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
destructuredArrayIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_"
}
],
"no-case-declarations": "off",
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "error"
}
}
);
/** @type {import("eslint").Linter.Config[]} */
export default [...base];
4 changes: 4 additions & 0 deletions examples/test-app/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import reactInternal from "@parcnet/eslint-config/eslint.reactInternal.config.mjs";

/** @type {import("eslint").Linter.Config[]} */
export default [...reactInternal];
8 changes: 2 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,14 @@
"watch": "turbo watch build --filter='./packages/**'"
},
"devDependencies": {
"@eslint/js": "^9.9.0",
"eslint-plugin-chai-friendly": "^1.0.1",
"eslint-plugin-react-hooks": "^5.1.0-rc.0",
"knip": "^5.29.2",
"prettier": "^3.2.5",
"turbo": "^2.0.14",
"typescript": "^5.4.5",
"typescript-eslint": "^8.0.1"
"typescript": "^5.4.5"
},
"packageManager": "[email protected]",
"engines": {
"node": ">=18"
"node": ">=22"
},
"dependencies": {
"mprocs": "^0.7.1"
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# `@turbo/eslint-config`
# `@parcnet/eslint-config`

Collection of internal eslint configurations.
58 changes: 58 additions & 0 deletions packages/eslint-config/eslint.base.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import eslint from "@eslint/js";
import tseslint from "typescript-eslint";
import pluginChaiFriendly from "eslint-plugin-chai-friendly";
import hooksPlugin from "eslint-plugin-react-hooks";
import eslintPluginPrettier from "eslint-plugin-prettier";
import eslintPluginTurbo from "eslint-plugin-turbo";

export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
...tseslint.configs.stylistic,

{
ignores: ["**/node_modules/*", "**/dist/"] // global ignore with single ignore key
},
{
languageOptions: {
parserOptions: {
project: false,
tsconfigRootDir: import.meta.dirname
}
},
files: ["src/**/*.{ts,tsx}"]
},
{
plugins: {
"chai-friendly": pluginChaiFriendly,
"react-hooks": hooksPlugin,
prettier: eslintPluginPrettier,
turbo: eslintPluginTurbo
},
rules: {
...hooksPlugin.configs.recommended.rules,
"prettier/prettier": "error",
"turbo/no-undeclared-env-vars": "error"
}
},
{
rules: {
"@typescript-eslint/no-unused-expressions": "off",
"chai-friendly/no-unused-expressions": "error",
"@typescript-eslint/consistent-type-definitions": "off",
// enable underscore ignore pattern for unused vars
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
destructuredArrayIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_"
}
],
"no-case-declarations": "off",
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "error"
}
}
);
13 changes: 13 additions & 0 deletions packages/eslint-config/eslint.reactInternal.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import baseConfig from "./eslint.base.config.mjs";
import tseslint from "typescript-eslint";
import globals from "globals";

export default tseslint.config(...baseConfig, {
languageOptions: {
globals: {
...globals.browser,
React: true,
JSX: true
}
}
});
47 changes: 0 additions & 47 deletions packages/eslint-config/library.js

This file was deleted.

35 changes: 0 additions & 35 deletions packages/eslint-config/next.js

This file was deleted.

14 changes: 8 additions & 6 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@
"name": "@parcnet/eslint-config",
"version": "0.0.0",
"private": true,
"files": [
"library.js",
"next.js",
"react-internal.js"
],
"type": "module",
"devDependencies": {
"@eslint/js": "^9.9.0",
"@typescript-eslint/eslint-plugin": "^8.4.0",
"@typescript-eslint/parser": "^8.4.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-turbo": "^2.0.0",
"eslint-plugin-chai-friendly": "^1.0.1",
"eslint-plugin-only-warn": "^1.1.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react-hooks": "^5.1.0-rc.0",
"eslint-plugin-tree-shaking": "^1.12.2",
"typescript": "^5.3.3"
"eslint-plugin-turbo": "^2.1.1",
"globals": "^15.9.0",
"typescript": "^5.3.3",
"typescript-eslint": "^8.0.1"
}
}
39 changes: 0 additions & 39 deletions packages/eslint-config/react-internal.js

This file was deleted.

Loading

0 comments on commit 6a8d022

Please sign in to comment.