Update
This commit is contained in:
@ -18,10 +18,10 @@
|
||||
"subject": "[readme] fix typo in shareable config section in readme"
|
||||
},
|
||||
"eslint-plugin-n": {
|
||||
"hash": "6744257b43560181412a76eadeb7de564b886ad4",
|
||||
"date": "2024-07-26T11:46:54+01:00",
|
||||
"hash": "e5e758ea0cd238220127ae7bcbd967f1d8920f28",
|
||||
"date": "2024-08-06T04:22:42+12:00",
|
||||
"committer": "GitHub",
|
||||
"subject": "chore(master): release 17.10.1 (#319)"
|
||||
"subject": "docs(process-exit-as-throw): update wording (#323)"
|
||||
},
|
||||
"eslint-plugin-react": {
|
||||
"hash": "983b88dd3cb5e07919517d3fde4085f60883ded7",
|
||||
|
13
src/index.ts
13
src/index.ts
@ -10,8 +10,9 @@ import { importTypeScript } from './presets/typescript';
|
||||
import { unicorn } from './presets/unicorn';
|
||||
import { eslintRules } from './presets/eslint';
|
||||
import { custom } from './presets/custom';
|
||||
import { error, warn, off } from './constants';
|
||||
import { off } from './constants';
|
||||
import { checkEnv } from './env';
|
||||
import { stylistic } from './presets/stylistic';
|
||||
|
||||
export { graphql } from './presets/graphql';
|
||||
export { jsdoc } from './presets/jsdoc';
|
||||
@ -19,7 +20,7 @@ export { storybook } from './presets/misc';
|
||||
export { react, reactRefresh } from './presets/react';
|
||||
export { tailwind } from './presets/tailwind';
|
||||
|
||||
export { error, warn, off };
|
||||
export { error, warn, off } from './constants';
|
||||
|
||||
declare global {
|
||||
interface Array<T> {
|
||||
@ -103,6 +104,9 @@ export type InputConfig = Omit<ESLintConfig, 'rules'> & {
|
||||
*
|
||||
* Non bundled:
|
||||
* 1. [`graphql`](https://the-guild.dev/graphql/eslint/rules)
|
||||
*
|
||||
* @param of Configuration options.
|
||||
* @returns ESLint configuration object.
|
||||
*/
|
||||
export function extendConfig(
|
||||
of: InputConfig & {
|
||||
@ -124,8 +128,8 @@ export function extendConfig(
|
||||
...rest
|
||||
} = of;
|
||||
|
||||
let plugins: Plugin[] = [..._plugins];
|
||||
let extend: Extends[] = ensureArray(_extends);
|
||||
const plugins: Plugin[] = [..._plugins];
|
||||
const extend: Extends[] = ensureArray(_extends);
|
||||
|
||||
if (customRuleFiles != null) {
|
||||
plugins.push('local');
|
||||
@ -135,6 +139,7 @@ export function extendConfig(
|
||||
importTypeScript,
|
||||
unicorn,
|
||||
custom,
|
||||
stylistic,
|
||||
...(auto ? checkEnv() : []),
|
||||
..._middlewares,
|
||||
]);
|
||||
|
@ -43,15 +43,6 @@ export const eslintRules: Partial<EslintRulesObject> = {
|
||||
'prefer-spread': warn,
|
||||
'quote-props': [error, 'as-needed'],
|
||||
'sort-imports': [warn, { ignoreDeclarationSort: true }],
|
||||
'spaced-comment': [
|
||||
error,
|
||||
'always',
|
||||
{
|
||||
markers: ['/', '#', '@'],
|
||||
// allow /*@__PURE__*/
|
||||
block: { exceptions: ['@'] },
|
||||
},
|
||||
],
|
||||
complexity: [warn, { max: 100 }],
|
||||
curly: [error, 'multi-line', 'consistent'],
|
||||
eqeqeq: [error, 'smart'],
|
||||
|
19
src/presets/stylistic.ts
Normal file
19
src/presets/stylistic.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import { error } from '../constants';
|
||||
import { defineMiddleware } from '../middleware';
|
||||
import type { StylisticRulesObject } from '@aet/eslint-define-config/src/rules/stylistic';
|
||||
|
||||
const stylisticRules: Partial<StylisticRulesObject> = {
|
||||
'stylistic/spaced-comment': [
|
||||
error,
|
||||
'always',
|
||||
{
|
||||
markers: ['/', '#', '@'],
|
||||
// allow /*@__PURE__*/
|
||||
block: { exceptions: ['@'] },
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export const stylistic = defineMiddleware((_, { addRules }) => {
|
||||
addRules(stylisticRules);
|
||||
});
|
@ -8,7 +8,7 @@ const alias = new Set([
|
||||
'eslint-plugin-local',
|
||||
'eslint-plugin-n',
|
||||
'eslint-plugin-react-hooks',
|
||||
'eslint-plugin-rules',
|
||||
'eslint-plugin-custom',
|
||||
]);
|
||||
|
||||
type CDR<T> = T extends [any, ...infer R] ? R : [];
|
||||
|
Reference in New Issue
Block a user