Skip to content

Commit

Permalink
fix eslint (#25)
Browse files Browse the repository at this point in the history
* fix eslint

* bump
  • Loading branch information
adjsky authored Sep 13, 2024
1 parent a7ceb0f commit 423f450
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 30 deletions.
2 changes: 1 addition & 1 deletion packages/eslint-plugin-resulto/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-resulto",
"version": "2.0.0-beta.0",
"version": "2.0.0-beta.1",
"description": "ESLint plugin for resulto",
"scripts": {
"ts-check": "tsc --noEmit",
Expand Down
8 changes: 0 additions & 8 deletions packages/eslint-plugin-resulto/src/configs/recommended.ts

This file was deleted.

30 changes: 21 additions & 9 deletions packages/eslint-plugin-resulto/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@
import packageJson from "../package.json"
import recommended from "./configs/recommended"
import mustUseResult from "./rules/must-use-result"
import { FlatConfig } from "@typescript-eslint/utils/ts-eslint"

import type { Linter } from "@typescript-eslint/utils/ts-eslint"
import { name, version } from "../package.json"
import mustUseResult from "./rules/must-use-result"

export default {
const plugin = {
configs: {
recommended
get recommended() {
return recommended
}
},
meta: {
name: packageJson.name,
version: packageJson.version
name,
version
},
rules: {
"must-use-result": mustUseResult
}
} satisfies Linter.Plugin
} satisfies FlatConfig.Plugin

const recommended: FlatConfig.Config = {
plugins: {
resulto: plugin
},
rules: {
"resulto/must-use-result": "error"
}
}

export default plugin
11 changes: 0 additions & 11 deletions packages/eslint-plugin-resulto/src/utility/trim-leading-indent.ts

This file was deleted.

10 changes: 9 additions & 1 deletion packages/eslint-plugin-resulto/test/inject-code.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import { trimLeadingIndent } from "../src/utility/trim-leading-indent"
function trimLeadingIndent(str: string) {
const matched = str.match(/^[\r\n]?(\s+)/)

if (!matched) {
return str
}

return str.replace(new RegExp("^" + matched[1], "gm"), "").trim()
}

export function injectCode(code: string) {
return `
Expand Down

0 comments on commit 423f450

Please sign in to comment.