Skip to content

Commit ab9ce84

Browse files
authored
Use defineConfig in shared configs (#43)
1 parent d33e646 commit ab9ce84

File tree

3 files changed

+21
-15
lines changed

3 files changed

+21
-15
lines changed

.changeset/fresh-coins-see.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@awesome-code-style/eslint-config': patch
3+
---
4+
5+
Use defineConfig

packages/eslint-config/index.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ import prettier from 'eslint-config-prettier';
44
import importPlugin from 'eslint-plugin-import';
55
import simpleImportSortPlugin from 'eslint-plugin-simple-import-sort';
66
import unusedImportsPlugin from 'eslint-plugin-unused-imports';
7+
import { defineConfig } from 'eslint/config';
78
import tseslint from 'typescript-eslint';
89

910
export const configs = {
10-
default: [
11+
default: defineConfig([
1112
js.configs.recommended,
12-
...tseslint.configs.recommended,
13-
...tseslint.configs.stylistic,
13+
tseslint.configs.recommended,
14+
tseslint.configs.stylistic,
1415
prettier,
1516
{
1617
plugins: {
@@ -128,11 +129,11 @@ export const configs = {
128129
],
129130
},
130131
},
131-
],
132+
]),
132133

133-
typeChecked: [
134-
...tseslint.configs.recommendedTypeCheckedOnly,
135-
...tseslint.configs.stylisticTypeCheckedOnly,
134+
typeChecked: defineConfig([
135+
tseslint.configs.recommendedTypeCheckedOnly,
136+
tseslint.configs.stylisticTypeCheckedOnly,
136137
{
137138
languageOptions: {
138139
parserOptions: {
@@ -175,7 +176,7 @@ export const configs = {
175176
'@typescript-eslint/unbound-method': 'off',
176177
},
177178
},
178-
],
179+
]),
179180

180181
disableTypeChecked: tseslint.configs.disableTypeChecked,
181182
};

packages/eslint-config/react.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import reactPlugin from 'eslint-plugin-react';
22
import reactHooksPlugin from 'eslint-plugin-react-hooks';
33
import jsxExpressionsPlugin from '@jgoz/eslint-plugin-jsx-expressions';
4+
import { defineConfig } from 'eslint/config';
45

56
import { configs as baseConfigs } from './index.js';
67

78
export const reactConfigs = {
8-
default: [
9+
default: defineConfig([
910
{
1011
settings: {
1112
react: {
@@ -43,8 +44,8 @@ export const reactConfigs = {
4344
'react/display-name': 'off',
4445
},
4546
},
46-
],
47-
reactTypeChecked: [
47+
]),
48+
reactTypeChecked: defineConfig([
4849
{
4950
files: ['**/*.tsx'],
5051
plugins: {
@@ -54,14 +55,13 @@ export const reactConfigs = {
5455
'jsx-expressions/strict-logical-expressions': ['error', { allowString: true }],
5556
},
5657
},
57-
],
58-
disableReactTypeChecked: {
59-
...baseConfigs.disableTypeChecked,
58+
]),
59+
disableReactTypeChecked: defineConfig(baseConfigs.disableTypeChecked, {
6060
rules: {
6161
...baseConfigs.disableTypeChecked.rules,
6262
'jsx-expressions/strict-logical-expressions': 'off',
6363
},
64-
},
64+
}),
6565
};
6666

6767
export default reactConfigs.default;

0 commit comments

Comments
 (0)