Skip to content

Commit

Permalink
Applied ESLint code fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaid committed Mar 19, 2024
1 parent 86d89e0 commit ea61409
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 15 deletions.
18 changes: 9 additions & 9 deletions package.json
@@ -1,7 +1,7 @@
{
"name": "eslint-config-jaid",
"version": "8.23.0",
"type": "module",
"name": "eslint-config-jaid",
"description": "Personal ESLint preset. Intentionally ugly to write code that looks like I feel.",
"keywords": [
"ecmascript",
Expand All @@ -25,10 +25,17 @@
],
"author": "Jaid <jaid.jsx@gmail.com> (https://github.com/Jaid)",
"funding": "https://github.com/sponsors/jaid",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/jaid/eslint-config-jaid"
},
"scripts": {
"build": "tsx src/build.ts",
"release": "npm run build && find out/package -mindepth 1 -maxdepth 1 -type d -exec sh -c 'cd {} && npm publish' \\;",
"buildPage": "fse emptyDir dist/page && tsx src/scripts/activeHtml.ts && tsx src/scripts/unusedHtml.ts && tsx src/scripts/deprecatedHtml.ts && fse copy etc/page dist/page",
"test": "node --import tsx --test test/index.ts"
},
"dependencies": {
"@typescript-eslint/eslint-plugin": "^7.3.1",
"@typescript-eslint/parser": "^7.3.1",
Expand Down Expand Up @@ -77,12 +84,5 @@
"tsx": "^4.7.1",
"type-fest": "^4.12.0",
"yaml": "^2.4.1"
},
"scripts": {
"build": "tsx src/build.ts",
"release": "npm run build && find out/package -mindepth 1 -maxdepth 1 -type d -exec sh -c 'cd {} && npm publish' \\;",
"buildPage": "fse emptyDir dist/page && tsx src/scripts/activeHtml.ts && tsx src/scripts/unusedHtml.ts && tsx src/scripts/deprecatedHtml.ts && fse copy etc/page dist/page",
"test": "node --import tsx --test test/index.ts"
},
"license": "MIT"
}
}
3 changes: 2 additions & 1 deletion src/ConfigBuilder.ts
@@ -1,7 +1,6 @@
import path from 'node:path'
import {pathToFileURL} from 'node:url'

import publishimo from './lib/esm/publishimo.js'
import chalk from 'chalk'
import createDebug from 'debug'
import {emp} from 'emp'
Expand All @@ -13,6 +12,8 @@ import {pick} from 'lodash-es'
import prettyBytes from 'pretty-bytes'
import sortKeys from 'sort-keys'

import publishimo from './lib/esm/publishimo.js'

const debug = createDebug(`eslint-config-jaid`)

export default class ConfigBuilder {
Expand Down
3 changes: 2 additions & 1 deletion src/build.ts
Expand Up @@ -3,7 +3,6 @@ import type {PackageJson} from 'type-fest'
import path from 'node:path'
import {fileURLToPath, pathToFileURL} from 'node:url'

import publishimo from './lib/esm/publishimo.js'
import chalk from 'chalk'
import {emp} from 'emp'
import {includeKeys} from 'filter-obj'
Expand All @@ -14,6 +13,8 @@ import * as lodash from 'lodash-es'
import prettyBytes from 'pretty-bytes'
import sortKeys from 'sort-keys'

import publishimo from './lib/esm/publishimo.js'

const pkg: PackageJson = await fs.readJson(`package.json`)
const dirName = path.dirname(fileURLToPath(import.meta.url))
const presets = await fs.readdir(path.join(dirName, `presets`))
Expand Down
4 changes: 2 additions & 2 deletions src/lib/listRules.ts
Expand Up @@ -12,10 +12,10 @@ export type Rule = {

export default async (eslintConfigFile: string, ruleFinderFunction: RuleFinderFunction) => {
const ruleFinder = await eslintFindRules(eslintConfigFile)
const unusedRules: string[] = ruleFinder[ruleFinderFunction]().filter(ruleId => {
const unusedRules: Array<string> = ruleFinder[ruleFinderFunction]().filter(ruleId => {
return ruleId.split(`/`).length <= 2
})
const rules: Rule[] = unusedRules.map(ruleId => {
const rules: Array<Rule> = unusedRules.map(ruleId => {
const parts = ruleId.split(`/`)
if (parts.length === 1) {
return {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/makeHtml.ts
Expand Up @@ -11,7 +11,7 @@ import getLinkToRule from 'src/lib/getLinkToRule.ts'

type Selector = `current` | `deprecated` | `unused`

export default (title: string, rules: Dictionary<Rule[]>) => {
export default (title: string, rules: Dictionary<Array<Rule>>) => {
const markdownTemplate = `
# {{title}}
{{#each rules}}
Expand Down
2 changes: 1 addition & 1 deletion test/index.ts
Expand Up @@ -11,7 +11,7 @@ import fs from 'fs-extra'
import * as lodash from 'lodash-es'

const debug = createDebug(`eslint-config-jaid`)
const pkg = <PackageJson> await fs.readJson(`package.json`)
const pkg = await fs.readJson(`package.json`) as PackageJson
const dirName = path.dirname(fileURLToPath(import.meta.url))
const srcFolder = path.join(dirName, `..`, `src`)
const presetsFolder = path.join(srcFolder, `presets`)
Expand Down

0 comments on commit ea61409

Please sign in to comment.