Skip to content

Commit db05800

Browse files
authored
v1.1.1_flat-config - Code Optimization (#19)
* flat configs rewritten * rm project from parserOptions * add .tgz to gitignore
1 parent d97b78f commit db05800

File tree

5 files changed

+84
-49
lines changed

5 files changed

+84
-49
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
node_modules
22
.DS_Store
33

4-
publish.sh
4+
publish.sh
5+
*.tgz

packages/eslint-flat-config/lib/js/index.mjs

+22-13
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ import tseslint from 'typescript-eslint';
44
import stylistic from '@stylistic/eslint-plugin';
55

66
export default [
7-
js.configs.recommended,
8-
...tseslint.configs.recommended,
7+
/* Global Language Options */
98
{
109
languageOptions: {
1110
ecmaVersion: 2022,
@@ -15,6 +14,25 @@ export default [
1514
...globals.jest
1615
}
1716
},
17+
},
18+
19+
/* File and ignore patterns */
20+
{
21+
files: ['**/*.{js,mjs,cjs,ts}'],
22+
ignores: [
23+
'node_modules',
24+
'dist',
25+
'build',
26+
'coverage',
27+
'.turbo',
28+
]
29+
},
30+
/* Recommended Configs */
31+
js.configs.recommended,
32+
...tseslint.configs.recommended,
33+
34+
/* Plugins & Rules */
35+
{
1836
plugins: {
1937
'@stylistic': stylistic,
2038
},
@@ -104,15 +122,6 @@ export default [
104122
semi: ['warn', 'always'],
105123
'require-await': 'warn',
106124
'use-isnan': 'warn',
107-
},
108-
ignores: [
109-
'node_modules',
110-
'dist',
111-
'build',
112-
'coverage',
113-
'.turbo',
114-
'.eslintrc.js',
115-
'.d.ts',
116-
],
117-
},
125+
}
126+
}
118127
];

packages/eslint-flat-config/lib/jsx/index.mjs

+32-20
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import globals from 'globals';
22
import stylistic from '@stylistic/eslint-plugin';
33
import jsxA11y from 'eslint-plugin-jsx-a11y';
4-
import pluginReact from "eslint-plugin-react";
4+
import pluginReact from 'eslint-plugin-react';
55
import reactHooksPlugin from 'eslint-plugin-react-hooks';
66

77
export default [
8-
jsxA11y.flatConfigs.recommended,
9-
pluginReact.configs.flat.recommended,
8+
/* Global Language Options */
109
{
1110
languageOptions: {
1211
ecmaVersion: 2022,
@@ -18,6 +17,34 @@ export default [
1817
},
1918
},
2019
},
20+
settings: {
21+
react: {
22+
version: 'detect',
23+
},
24+
},
25+
},
26+
27+
/* File and ignore patterns */
28+
{
29+
files: ['**/*.{js,mjs,cjs,ts,jsx,tsx}'],
30+
ignores: [
31+
'node_modules',
32+
'dist',
33+
'build',
34+
'coverage',
35+
'.next',
36+
'.turbo',
37+
'.eslintcache',
38+
'storybook-static',
39+
],
40+
},
41+
42+
/* Recommended Configs */
43+
jsxA11y.flatConfigs.recommended,
44+
pluginReact.configs.flat.recommended,
45+
46+
/* Plugins & Rules */
47+
{
2148
plugins: {
2249
'@stylistic': stylistic,
2350
'react-hooks': reactHooksPlugin
@@ -54,21 +81,6 @@ export default [
5481
extensions: ['.tsx', '.jsx'],
5582
},
5683
],
57-
},
58-
settings: {
59-
react: {
60-
version: 'detect',
61-
},
62-
},
63-
ignores: [
64-
'node_modules',
65-
'dist',
66-
'build',
67-
'coverage',
68-
'.next',
69-
'.turbo',
70-
'.eslintrc.js',
71-
'.d.ts',
72-
],
73-
},
84+
}
85+
}
7486
];

packages/eslint-flat-config/lib/next/index.mjs

+27-14
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import js from '@eslint/js';
1616
import stylistic from '@stylistic/eslint-plugin';
1717

1818
export default [
19-
js.configs.recommended,
19+
/* Global Language Options */
2020
{
2121
languageOptions: {
2222
ecmaVersion: 2022,
@@ -32,14 +32,36 @@ export default [
3232
},
3333
},
3434
},
35-
plugins: {
36-
'@stylistic': stylistic,
37-
},
38-
settings: {
35+
settings: {
3936
react: {
4037
version: 'detect',
4138
},
4239
},
40+
},
41+
42+
/* File and ignore patterns */
43+
{
44+
files: ['**/*.{js,mjs,cjs,ts,jsx,tsx}'],
45+
ignores: [
46+
'node_modules',
47+
'dist',
48+
'build',
49+
'coverage',
50+
'.next',
51+
'.turbo',
52+
'.eslintcache',
53+
'storybook-static',
54+
],
55+
},
56+
57+
/* Recommended Configs */
58+
js.configs.recommended,
59+
60+
/* Plugins & Rules */
61+
{
62+
plugins: {
63+
'@stylistic': stylistic,
64+
},
4365
rules: {
4466
'@stylistic/array-bracket-spacing': 'warn',
4567
'@stylistic/arrow-parens': ['warn', 'as-needed'],
@@ -128,14 +150,5 @@ export default [
128150
'require-await': 'warn',
129151
'use-isnan': 'warn',
130152
},
131-
ignores: [
132-
'node_modules',
133-
'dist',
134-
'build',
135-
'coverage',
136-
'.turbo',
137-
'.eslintrc.js',
138-
'.d.ts',
139-
],
140153
},
141154
];

packages/eslint-flat-config/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nish1896/eslint-flat-config",
3-
"version": "1.1.0",
3+
"version": "1.1.1",
44
"description": "eslint and stylistic rules for eslint v9 and above to take care of the code formatting.",
55
"author": "Nishant Kohli",
66
"engines": {

0 commit comments

Comments
 (0)