Skip to content

Commit

Permalink
introducing prettierOverride config (#24)
Browse files Browse the repository at this point in the history
* introducing prettierOverride config

For the following rules:
* no-multiple-empty-lines
* key-spacing

* v0.0.15
  • Loading branch information
whyhankee authored Oct 27, 2024
1 parent 48bad21 commit e9ddc2d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wescfg",
"version": "0.0.14",
"version": "0.0.15",
"description": "Whyhankee's ESlint/Prettier config",
"main": "src/index.mjs",
"type": "module",
Expand Down
23 changes: 22 additions & 1 deletion src/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import tseslint from "typescript-eslint"

export {globals}

export const eslintRules = {
// Our own prettier config
const eslintRules = {
// utility
"no-console": [
"error",
Expand All @@ -25,6 +26,25 @@ export const eslintRules = {
"simple-import-sort/imports": "error",
}

// Overrides for the prettier config
const eslintPrettierOverride = {
"no-multiple-empty-lines": [
"error",
{
max: 2,
},
],
"key-spacing": [
"error",
{
beforeColon: false,
afterColon: true,
mode: "strict",
},
],
}

// Export esLintConfig
export const eslintConfig = [
{
ignores: ["dist/*"],
Expand All @@ -38,6 +58,7 @@ export const eslintConfig = [
...tseslint.configs.recommended,
{rules: eslintRules},
eslintConfigPrettier,
{rules: eslintPrettierOverride},
]

export const prettierConfig = {
Expand Down
7 changes: 1 addition & 6 deletions tests/index.test.mjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
import assert from "node:assert"
import {test} from "node:test"

import {eslintConfig, eslintRules, prettierConfig} from "../src/index.mjs"
import {eslintConfig, prettierConfig} from "../src/index.mjs"

// Basic tests that at least make sure the syntax is correct

test("eslintRules", () => {
assert(Object.keys(eslintRules).includes("no-console"))
})

test("eslintConfig", () => {
assert(Array.isArray(eslintConfig))
})
Expand Down

0 comments on commit e9ddc2d

Please sign in to comment.