How to use the eslint-config-prettier/flowtype.rules function in eslint-config-prettier

To help you get started, we’ve selected a few eslint-config-prettier examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AlloyTeam / eslint-config-alloy / scripts / rulesCoverage.ts View on Github external
/* eslint-disable @typescript-eslint/no-require-imports */
import fs from 'fs';
import path from 'path';

import { NAMESPACE_CONFIG, NAMESPACES } from '../config';

/** 可用的规则(去除废弃的和 Prettier 的规则) */
let activeRules: string[] = [];
let deprecatedRules: string[] = [];
const prettierRules = [
    ...Object.keys(require('eslint-config-prettier').rules),
    ...Object.keys(require('eslint-config-prettier/@typescript-eslint').rules),
    ...Object.keys(require('eslint-config-prettier/babel').rules),
    ...Object.keys(require('eslint-config-prettier/flowtype').rules),
    ...Object.keys(require('eslint-config-prettier/react').rules),
    ...Object.keys(require('eslint-config-prettier/standard').rules),
    ...Object.keys(require('eslint-config-prettier/unicorn').rules),
    ...Object.keys(require('eslint-config-prettier/vue').rules)
];

// 填充 deprecatedRules 和 activeRules
Object.values(NAMESPACE_CONFIG).forEach(({ rulePrefix, pluginName }) => {
    const ruleEntries = pluginName
        ? Object.entries(require(pluginName).rules)
        : Array.from(require('eslint/lib/rules').entries());
    ruleEntries.forEach(([ruleName, ruleValue]) => {
        const fullRuleName = rulePrefix + ruleName;
        if (ruleValue.meta.deprecated) {
            deprecatedRules.push(fullRuleName);
            return;