Skip to content

Commit

Permalink
feat: rule yes
Browse files Browse the repository at this point in the history
  • Loading branch information
lzear committed Nov 4, 2023
1 parent 2ac25da commit 8c1e202
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 0 deletions.
29 changes: 29 additions & 0 deletions docs/rules/yes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: yes
description: Just passes
---

<script setup lang="ts">
import CodeEditor from '../../.vitepress/theme/components/code-editor.vue';
import {ruleName, presetConfigs, initialText, fakeLint} from '../../src/sample-code/yes.js';
</script>

> Silence is a source of great strength. — Lao Tzu
# Enforce nothing (`dont/yes`)

<!-- end auto-generated rule header -->

## 🔧 Config

```js
{ rules: { 'dont/yes': 2 } }
```

## 🔗 See also

- [node-noop](https://github.com/euank/node-noop): used in the implementation of this rule.

## 🧑‍💻 Demo

<CodeEditor :rule="ruleName" :text="initialText" :presetConfigs="presetConfigs" />
36 changes: 36 additions & 0 deletions rules/yes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// @ts-expect-error - required for node-noop
import noop from 'node-noop'

import type { RuleListener } from '../utils/eslint-types/Rule.js'

import { createEslintRule } from '../utils/create-eslint-rule.js'
type MESSAGE_ID = 'yes'

type Options = []

export const RULE_NAME = 'yes'

export default createEslintRule<Options, MESSAGE_ID>({
name: RULE_NAME,
meta: {
type: 'problem',
docs: {
description: 'enforce nothing',
},
schema: [
{
type: 'object',
properties: {},
},
],
messages: {
yes: 'yes',
},
},
defaultOptions: [],
create: (): RuleListener => {
noop()
return {
}
},
})
19 changes: 19 additions & 0 deletions src/sample-code/yes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import type { PresetConfig } from './presets.js'

export const ruleName = 'yes'

export const presetConfigs = [] satisfies PresetConfig[]

export const initialText = `// just pass
`

export const fakeLint = async (code: string) => {
return {
fix: {
fixed: false,
messages: [],
output: code,
},
verify: [],
}
}

0 comments on commit 8c1e202

Please sign in to comment.