Skip to content

Commit 9cc3961

Browse files
committed
Revert some changes not needed
1 parent 978f965 commit 9cc3961

File tree

2 files changed

+123
-38
lines changed

2 files changed

+123
-38
lines changed

eslint.config.ts

Lines changed: 122 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,147 @@
1-
import js from "@eslint/js";
2-
import tseslint from "@typescript-eslint/eslint-plugin";
3-
import tsparser from "@typescript-eslint/parser";
4-
import react from "eslint-plugin-react";
5-
import reactHooks from "eslint-plugin-react-hooks";
6-
import importPlugin from "eslint-plugin-import";
7-
import type { Linter } from "eslint";
1+
import js from '@eslint/js';
2+
import tseslint from '@typescript-eslint/eslint-plugin';
3+
import tsparser from '@typescript-eslint/parser';
4+
// @ts-ignore - Plugin doesn't have proper ESLint 9 types yet
5+
import importPlugin from 'eslint-plugin-import';
6+
// @ts-ignore - Plugin doesn't have proper ESLint 9 types yet
7+
import react from 'eslint-plugin-react';
8+
// @ts-ignore - Plugin doesn't have proper ESLint 9 types yet
9+
import reactHooks from 'eslint-plugin-react-hooks';
10+
import prettierConfig from 'eslint-config-prettier';
811

912
export default [
13+
// Base recommended configurations
1014
js.configs.recommended,
15+
16+
// TypeScript configuration for all TypeScript files
1117
{
12-
files: ["**/*.{js,jsx,ts,tsx}"],
18+
files: ['src/**/*.{ts,tsx}'],
1319
languageOptions: {
1420
parser: tsparser,
1521
parserOptions: {
16-
ecmaVersion: "latest",
17-
sourceType: "module",
22+
ecmaVersion: 'latest',
23+
sourceType: 'module',
24+
project: './tsconfig.json',
1825
ecmaFeatures: {
1926
jsx: true,
2027
},
2128
},
2229
globals: {
23-
// Node.js globals
24-
process: "readonly",
25-
console: "readonly",
26-
// TypeScript/React globals
27-
React: "readonly",
28-
JSX: "readonly",
30+
// Only keep React global for JSX without explicit React imports
31+
React: 'writable',
2932
},
3033
},
3134
plugins: {
32-
"@typescript-eslint": tseslint as any,
33-
react: react as any,
34-
"react-hooks": reactHooks as any,
35-
import: importPlugin as any,
35+
'@typescript-eslint': tseslint,
3636
},
3737
rules: {
38+
// Disable core ESLint rules that are covered by TypeScript
39+
'no-unused-vars': 'off',
40+
'no-undef': 'off', // TypeScript handles this
41+
42+
// Apply TypeScript ESLint recommended rules
3843
...tseslint.configs.recommended.rules,
39-
...react.configs.recommended.rules,
40-
...reactHooks.configs.recommended.rules,
41-
"react/react-in-jsx-scope": "off",
42-
"react/prop-types": "off",
43-
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
44-
"@typescript-eslint/explicit-function-return-type": "off",
45-
"@typescript-eslint/explicit-module-boundary-types": "off",
46-
"@typescript-eslint/no-explicit-any": "warn",
47-
// Allow regex escape characters
48-
"no-useless-escape": "off",
44+
// Override specific rules for our project needs
45+
'@typescript-eslint/ban-ts-comment': 'off',
46+
'@typescript-eslint/no-explicit-any': 'warn',
4947
},
50-
settings: {
51-
react: {
52-
version: "detect",
48+
},
49+
50+
// Node.js CLI configuration
51+
{
52+
files: ['src/cli/**/*.{ts,tsx}'],
53+
languageOptions: {
54+
parser: tsparser,
55+
parserOptions: {
56+
ecmaVersion: 'latest',
57+
sourceType: 'module',
58+
project: './tsconfig.json',
5359
},
54-
"import/resolver": {
55-
typescript: {},
60+
globals: {
61+
// Only the Node.js globals actually used in CLI files
62+
process: 'readonly',
63+
console: 'readonly',
5664
},
5765
},
66+
plugins: {
67+
'@typescript-eslint': tseslint,
68+
},
69+
rules: {
70+
'no-unused-vars': 'off',
71+
'no-undef': 'off',
72+
...tseslint.configs.recommended.rules,
73+
'@typescript-eslint/ban-ts-comment': 'off',
74+
'@typescript-eslint/no-explicit-any': 'warn',
75+
},
5876
},
77+
78+
// React configuration
5979
{
60-
ignores: ["lib/**", "node_modules/**", "coverage/**"],
80+
files: ['src/**/*.{js,jsx,ts,tsx}'],
81+
languageOptions: {
82+
parser: tsparser,
83+
parserOptions: {
84+
ecmaVersion: 'latest',
85+
sourceType: 'module',
86+
project: './tsconfig.json',
87+
ecmaFeatures: {
88+
jsx: true,
89+
},
90+
},
91+
globals: {
92+
React: 'writable',
93+
},
94+
},
95+
plugins: {
96+
react,
97+
'react-hooks': reactHooks,
98+
import: importPlugin,
99+
},
100+
settings: {
101+
react: {
102+
version: 'detect',
103+
},
104+
'import/resolver': {
105+
typescript: {
106+
project: './tsconfig.json',
107+
},
108+
node: {
109+
extensions: ['.js', '.jsx', '.ts', '.tsx'],
110+
},
111+
},
112+
},
113+
rules: {
114+
// Apply React recommended rules
115+
...react.configs.recommended.rules,
116+
...react.configs['jsx-runtime'].rules,
117+
118+
// Apply React Hooks recommended rules
119+
...reactHooks.configs.recommended.rules,
120+
121+
// Apply Import recommended rules with custom order
122+
'import/no-unresolved': 'off', // TypeScript handles this
123+
'import/order': [
124+
'error',
125+
{
126+
groups: ['builtin', 'external', 'internal'],
127+
pathGroups: [
128+
{
129+
pattern: 'react',
130+
group: 'external',
131+
position: 'before',
132+
},
133+
],
134+
pathGroupsExcludedImportTypes: ['react'],
135+
'newlines-between': 'always',
136+
alphabetize: {
137+
order: 'asc',
138+
caseInsensitive: true,
139+
},
140+
},
141+
],
142+
},
61143
},
62-
];
144+
145+
// Prettier configuration (disables conflicting rules)
146+
prettierConfig,
147+
];

src/cli/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const extractStyles = (path: string) => {
2424
: fs.readFileSync(path).toString();
2525

2626
return fileContent.match(
27-
/([a-zA-Z_]*)(?:[.]{1})([a-zA-Z_]+[\w\-_]*)(?:[\s\.\,\{\>#\:]{0})/gim,
27+
/([a-zA-Z_]*)(?:[.]{1})([a-zA-Z_]+[\w\-_]*)(?:[\s.,{>#:]{0})/gim,
2828
);
2929
};
3030

0 commit comments

Comments
 (0)