@liberfi.io/eslint-config 0.1.6-main.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/index.mjs +181 -0
  3. package/package.json +24 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # @liberfi.io/eslint-config
2
+
3
+ ## 0.1.6-main.0
4
+
5
+ ### Patch Changes
6
+
7
+ - publish
package/index.mjs ADDED
@@ -0,0 +1,181 @@
1
+ import stylistic from "@stylistic/eslint-plugin";
2
+ import eslintConfigPrettier from "eslint-config-prettier/flat";
3
+ // import importPlugin from "eslint-plugin-import";
4
+ import monorepoCop from "eslint-plugin-monorepo-cop";
5
+ import reactPlugin from "eslint-plugin-react";
6
+ import * as reactHooks from "eslint-plugin-react-hooks";
7
+ import reactRefresh from "eslint-plugin-react-refresh";
8
+ // TODO tailwind v4 not supported yet
9
+ // import tailwind from "eslint-plugin-tailwindcss";
10
+ import { defineConfig, globalIgnores } from "eslint/config";
11
+ import globals from "globals";
12
+ // import path from "path";
13
+ import ts from "typescript-eslint";
14
+
15
+ // import { fileURLToPath } from "url";
16
+
17
+ // const __filename = fileURLToPath(import.meta.url);
18
+ // const __dirname = path.dirname(__filename);
19
+
20
+ export default defineConfig([
21
+ globalIgnores([
22
+ "**/build/",
23
+ "**/dist/",
24
+ "**/node_modules/",
25
+ "**/public/",
26
+ "**/__test__/",
27
+ "**/storybook-static/",
28
+ // TODO: remove this when packages/component/ deleted
29
+ // "packages/component/",
30
+ // TODO: remove this when apps/docs/ deleted
31
+ // "apps/docs/",
32
+ "**/*.js",
33
+ "**/*.cjs",
34
+ "**/*.d.ts",
35
+ ]),
36
+ {
37
+ languageOptions: {
38
+ // parser: typescriptEslintParser,
39
+ parserOptions: {
40
+ ecmaFeatures: {
41
+ jsx: true,
42
+ },
43
+ },
44
+ globals: {
45
+ ...globals.browser,
46
+ },
47
+ },
48
+ },
49
+ // add eslint built-in
50
+ // https://github.com/eslint/eslint/blob/main/packages/js/src/configs/eslint-recommended.js
51
+ // js.configs.recommended,
52
+
53
+ // add `typescript-eslint` flat config simply
54
+ // if you would like use more another configuration,
55
+ // see the section: https://typescript-eslint.io/getting-started#details
56
+ // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslintrc/recommended.ts
57
+ ...ts.configs.recommended,
58
+
59
+ // TODO tailwind v4 not supported yet
60
+ // https://github.com/francoismassart/eslint-plugin-tailwindcss
61
+ // https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/lib/config/flat-recommended.js
62
+ // ...tailwind.configs["flat/recommended"],
63
+
64
+ // https://github.com/vercel/turborepo/blob/main/packages/eslint-config-turbo/src/flat/index.ts
65
+ // ...turboConfig,
66
+
67
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/index.js#L108
68
+ reactPlugin.configs.flat.recommended,
69
+ // Add this if you are using React 17+
70
+ reactPlugin.configs.flat["jsx-runtime"],
71
+
72
+ // https://github.com/import-js/eslint-plugin-import
73
+ // importPlugin.flatConfigs.recommended,
74
+ // use custom config instead of importPlugin.flatConfigs.recommended, because it's too strict for our project
75
+ // {
76
+ // plugins: {
77
+ // import: importPlugin,
78
+ // },
79
+ // rules: {
80
+ // "import/no-relative-packages": "error",
81
+ // // analysis/correctness
82
+ // "import/no-unresolved": "warn",
83
+ // "import/named": "warn",
84
+ // "import/namespace": "warn",
85
+ // "import/default": "warn",
86
+ // "import/export": "warn",
87
+
88
+ // // red flags (thus, warnings)
89
+ // "import/no-named-as-default": "warn",
90
+ // "import/no-named-as-default-member": "warn",
91
+ // "import/no-duplicates": "warn",
92
+ // },
93
+ // languageOptions: {
94
+ // // need all these for parsing dependencies (even if _your_ code doesn't need
95
+ // // all of them)
96
+ // parserOptions: {
97
+ // sourceType: "module",
98
+ // ecmaVersion: 2018,
99
+ // },
100
+ // },
101
+ // },
102
+ {
103
+ files: ["**/*.{ts,tsx}"],
104
+ // ignores: ["dist/**", "build/**", "node_modules/**"],
105
+ plugins: {
106
+ // https://eslint.style/packages/default
107
+ "@stylistic": stylistic,
108
+ "monorepo-cop": monorepoCop,
109
+ "react-hooks": reactHooks,
110
+ "react-refresh": reactRefresh,
111
+ },
112
+ rules: {
113
+ "no-console": ["warn", { allow: ["warn", "error"] }],
114
+ // "@stylistic/semi": ["error", "never"],
115
+ "prefer-const": "warn",
116
+ "@typescript-eslint/no-unused-expressions": "warn",
117
+ "@typescript-eslint/no-explicit-any": "warn",
118
+ "@typescript-eslint/no-unused-vars": "warn",
119
+ "@typescript-eslint/ban-ts-comment": "warn",
120
+ "@typescript-eslint/no-empty-object-type": "warn",
121
+ "@typescript-eslint/no-unused-vars": "warn",
122
+ "@typescript-eslint/no-unnecessary-type-constraint": "warn",
123
+ "@typescript-eslint/no-empty-object-type": "warn",
124
+ "@typescript-eslint/no-non-null-asserted-optional-chain": "warn",
125
+ "@typescript-eslint/no-namespace": "off",
126
+ "@typescript-eslint/ban-ts-comment": "off",
127
+ "react/prop-types": "off",
128
+ "react/display-name": "off",
129
+ "react/no-children-prop": "warn",
130
+ "tailwindcss/no-custom-classname": "off",
131
+
132
+ // https://github.com/sterlingwes/eslint-plugin-monorepo-cop
133
+ // prevent relative imports outside of monorepo package
134
+ "monorepo-cop/no-relative-import-outside-package": "error",
135
+ "monorepo-cop/no-disable-monorepo-no-relative-rule": "error",
136
+
137
+ // https://github.com/facebook/react/tree/main/packages/eslint-plugin-react-hooks#flat-config-eslintconfigjsts-1
138
+ "react-hooks/rules-of-hooks": "warn",
139
+ // it cause too many false positives, use eslint-plugin-react-hooks-configurable won't solve the problem either
140
+ // "react-hooks/exhaustive-deps": "warn",
141
+
142
+ // https://github.com/ArnaudBarre/eslint-plugin-react-refresh?tab=readme-ov-file#without-config
143
+ "react-refresh/only-export-components": "off",
144
+ // "react-refresh/only-export-components": [
145
+ // "warn",
146
+ // { allowConstantExport: true },
147
+ // ],
148
+ },
149
+ },
150
+
151
+ eslintConfigPrettier,
152
+ {
153
+ settings: {
154
+ react: {
155
+ version: "detect",
156
+ },
157
+ // TODO tailwind v4 not supported yet
158
+ // https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules
159
+ // tailwindcss: {
160
+ // callees: ["classnames", "cnBase", "cn"],
161
+ // config: path.resolve(__dirname, "../ui/tailwind.config.js"),
162
+ // // default
163
+ // cssFiles: [
164
+ // "**/*.css",
165
+ // "!**/node_modules",
166
+ // "!**/.*",
167
+ // "!**/dist",
168
+ // "!**/build",
169
+ // ],
170
+ // cssFilesRefreshRate: 5_000,
171
+ // removeDuplicates: true,
172
+ // skipClassAttribute: false,
173
+ // whitelist: [],
174
+ // // can be set to e.g. ['tw'] for use in tw`bg-blue`
175
+ // tags: [],
176
+ // // can be modified to support custom attributes. E.g. "^tw$" for `twin.macro`
177
+ // classRegex: "^class(Name)?$",
178
+ // },
179
+ },
180
+ },
181
+ ]);
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "@liberfi.io/eslint-config",
3
+ "version": "0.1.6-main.0",
4
+ "main": "index.mjs",
5
+ "module": "index.mjs",
6
+ "license": "MIT",
7
+ "publishConfig": {
8
+ "access": "public"
9
+ },
10
+ "dependencies": {
11
+ "@eslint/js": "^9.35.0",
12
+ "@stylistic/eslint-plugin": "^5.3.1",
13
+ "eslint-config-eslint": "^13.0.0",
14
+ "eslint-config-prettier": "^10.1.8",
15
+ "eslint-config-turbo": "^2.5.6",
16
+ "eslint-plugin-import": "^2.31.0",
17
+ "eslint-plugin-monorepo-cop": "^1.0.2",
18
+ "eslint-plugin-react": "^7.37.5",
19
+ "eslint-plugin-react-hooks": "^5.2.0",
20
+ "eslint-plugin-react-refresh": "^0.4.20",
21
+ "globals": "^16.4.0",
22
+ "typescript-eslint": "^8.43.0"
23
+ }
24
+ }