How to use the eslint-config-prettier/vue.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
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;
        }
        if (prettierRules.includes(fullRuleName)) {
            return;
        }
github AlloyTeam / eslint-config-alloy / scripts / removePrettierRules.ts View on Github external
/**
 * 批量删除 eslint-config-prettier 中的规则
 */
import fs from 'fs';
import path from 'path';
import rimraf from 'rimraf';

const prettier = require('eslint-config-prettier');
const prettierReact = require('eslint-config-prettier/react');
const prettierVue = require('eslint-config-prettier/vue');
const prettierTypeScript = require('eslint-config-prettier/@typescript-eslint');

const prettierRules = {
    index: prettier.rules,
    react: prettierReact.rules,
    vue: prettierVue.rules,
    typescript: prettierTypeScript.rules
};

const RULE_PREFIX_MAP = {
    index: '',
    react: 'react/',
    vue: 'vue/',
    typescript: '@typescript-eslint/'
};
type RulePrefix = keyof typeof RULE_PREFIX_MAP;
const namespaces: RulePrefix[] = ['index', 'react', 'vue', 'typescript'];

namespaces.forEach((namespace) => {
    fs.readdirSync(path.resolve(__dirname, '../test', namespace))
        .filter((ruleName) =>
            fs.lstatSync(path.resolve(__dirname, '../test', namespace, ruleName)).isDirectory()