Skip to content

Commit

Permalink
v1.1.1_flat-config - Code Optimization (#19)
Browse files Browse the repository at this point in the history
* flat configs rewritten

* rm project from parserOptions

* add .tgz to gitignore
  • Loading branch information
nishkohli96 authored Dec 18, 2024
1 parent d97b78f commit db05800
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 49 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules
.DS_Store

publish.sh
publish.sh
*.tgz
35 changes: 22 additions & 13 deletions packages/eslint-flat-config/lib/js/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import tseslint from 'typescript-eslint';
import stylistic from '@stylistic/eslint-plugin';

export default [
js.configs.recommended,
...tseslint.configs.recommended,
/* Global Language Options */
{
languageOptions: {
ecmaVersion: 2022,
Expand All @@ -15,6 +14,25 @@ export default [
...globals.jest
}
},
},

/* File and ignore patterns */
{
files: ['**/*.{js,mjs,cjs,ts}'],
ignores: [
'node_modules',
'dist',
'build',
'coverage',
'.turbo',
]
},
/* Recommended Configs */
js.configs.recommended,
...tseslint.configs.recommended,

/* Plugins & Rules */
{
plugins: {
'@stylistic': stylistic,
},
Expand Down Expand Up @@ -104,15 +122,6 @@ export default [
semi: ['warn', 'always'],
'require-await': 'warn',
'use-isnan': 'warn',
},
ignores: [
'node_modules',
'dist',
'build',
'coverage',
'.turbo',
'.eslintrc.js',
'.d.ts',
],
},
}
}
];
52 changes: 32 additions & 20 deletions packages/eslint-flat-config/lib/jsx/index.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import globals from 'globals';
import stylistic from '@stylistic/eslint-plugin';
import jsxA11y from 'eslint-plugin-jsx-a11y';
import pluginReact from "eslint-plugin-react";
import pluginReact from 'eslint-plugin-react';
import reactHooksPlugin from 'eslint-plugin-react-hooks';

export default [
jsxA11y.flatConfigs.recommended,
pluginReact.configs.flat.recommended,
/* Global Language Options */
{
languageOptions: {
ecmaVersion: 2022,
Expand All @@ -18,6 +17,34 @@ export default [
},
},
},
settings: {
react: {
version: 'detect',
},
},
},

/* File and ignore patterns */
{
files: ['**/*.{js,mjs,cjs,ts,jsx,tsx}'],
ignores: [
'node_modules',
'dist',
'build',
'coverage',
'.next',
'.turbo',
'.eslintcache',
'storybook-static',
],
},

/* Recommended Configs */
jsxA11y.flatConfigs.recommended,
pluginReact.configs.flat.recommended,

/* Plugins & Rules */
{
plugins: {
'@stylistic': stylistic,
'react-hooks': reactHooksPlugin
Expand Down Expand Up @@ -54,21 +81,6 @@ export default [
extensions: ['.tsx', '.jsx'],
},
],
},
settings: {
react: {
version: 'detect',
},
},
ignores: [
'node_modules',
'dist',
'build',
'coverage',
'.next',
'.turbo',
'.eslintrc.js',
'.d.ts',
],
},
}
}
];
41 changes: 27 additions & 14 deletions packages/eslint-flat-config/lib/next/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import js from '@eslint/js';
import stylistic from '@stylistic/eslint-plugin';

export default [
js.configs.recommended,
/* Global Language Options */
{
languageOptions: {
ecmaVersion: 2022,
Expand All @@ -32,14 +32,36 @@ export default [
},
},
},
plugins: {
'@stylistic': stylistic,
},
settings: {
settings: {
react: {
version: 'detect',
},
},
},

/* File and ignore patterns */
{
files: ['**/*.{js,mjs,cjs,ts,jsx,tsx}'],
ignores: [
'node_modules',
'dist',
'build',
'coverage',
'.next',
'.turbo',
'.eslintcache',
'storybook-static',
],
},

/* Recommended Configs */
js.configs.recommended,

/* Plugins & Rules */
{
plugins: {
'@stylistic': stylistic,
},
rules: {
'@stylistic/array-bracket-spacing': 'warn',
'@stylistic/arrow-parens': ['warn', 'as-needed'],
Expand Down Expand Up @@ -128,14 +150,5 @@ export default [
'require-await': 'warn',
'use-isnan': 'warn',
},
ignores: [
'node_modules',
'dist',
'build',
'coverage',
'.turbo',
'.eslintrc.js',
'.d.ts',
],
},
];
2 changes: 1 addition & 1 deletion packages/eslint-flat-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nish1896/eslint-flat-config",
"version": "1.1.0",
"version": "1.1.1",
"description": "eslint and stylistic rules for eslint v9 and above to take care of the code formatting.",
"author": "Nishant Kohli",
"engines": {
Expand Down

0 comments on commit db05800

Please sign in to comment.