Skip to content

Commit 4ef6281

Browse files
committed
chore: update lint rules
1 parent 26e538e commit 4ef6281

11 files changed

+17
-20
lines changed

eslint.config.mjs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
1-
import path from "node:path";
2-
import { fileURLToPath } from "node:url";
1+
import { resolve } from "node:path";
32
import { includeIgnoreFile } from "@eslint/compat";
43
import stylistic from "@stylistic/eslint-plugin";
54

6-
const __filename = fileURLToPath(import.meta.url);
7-
const __dirname = path.dirname(__filename);
8-
const gitignorePath = path.resolve(__dirname, ".gitignore");
9-
105
export default [
11-
includeIgnoreFile(gitignorePath),
6+
includeIgnoreFile(resolve(".gitignore")),
127
{
138
files: ["**/*.js", "**/*.mjs"],
149
plugins: {
1510
"@stylistic": stylistic
1611
},
1712
rules: {
1813
"camelcase": ["error"],
19-
"no-console": ["error", { allow: ["info", "warn"] }],
14+
"no-console": ["error", { allow: ["info", "warn", "error"] }],
15+
"sort-imports": ["error", { ignoreDeclarationSort: true }],
2016
"@stylistic/indent": ["error", 2, { SwitchCase: 1 }],
2117
"@stylistic/linebreak-style": ["error", process.platform === "win32" ? "windows" : "unix"],
2218
"@stylistic/quotes": ["error", "double"],
@@ -43,8 +39,9 @@ export default [
4339
"@stylistic/one-component-per-file": "off",
4440
"@stylistic/require-default-prop": "off",
4541
"@stylistic/space-in-parens": ["error", "never"],
46-
"@stylistic/template-curly-spacing": "error",
47-
"@stylistic/quote-props": ["error", "consistent-as-needed"]
42+
"@stylistic/no-multiple-empty-lines": ["error", { max: 1 }],
43+
"@stylistic/quote-props": ["error", "consistent-as-needed"],
44+
"@stylistic/arrow-parens": ["error", "as-needed", { requireForBlockBody: true }]
4845
}
4946
}
5047
];

src/card.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const getCard = (query, gistsResponse) => {
2626
let i = 0; // counter
2727
let newLine = false; // new line flag
2828

29-
gistsResponse.filter((gist) => gist.public).some((gist) => {
29+
gistsResponse.filter(gist => gist.public).some((gist) => {
3030
let filename = Object.keys(gist.files)[0]; // gist filename
3131
let language = gist.files[filename].language; // gist language
3232
let langColor = getLanguageColor(language); // gist language color

test/api.pin.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, it, expect, vi } from "vitest";
1+
import { describe, expect, it, vi } from "vitest";
22
import handler from "./../api/pin.js";
33

44
describe("render pin", () => {

test/api.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, it, expect, vi } from "vitest";
1+
import { describe, expect, it, vi } from "vitest";
22
import handler from "./../api/index.js";
33

44
describe("render card", () => {

test/card.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, it, expect } from "vitest";
1+
import { describe, expect, it } from "vitest";
22
import { getCard } from "./../src/card.js";
33

44
const fakeGists = [

test/getLanguageColor.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, it, expect } from "vitest";
1+
import { describe, expect, it } from "vitest";
22
import { getLanguageColor } from "./../src/functions.js";
33

44
describe("getLanguageColor", () => {

test/getTheme.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, it, expect } from "vitest";
1+
import { describe, expect, it } from "vitest";
22
import { getTheme } from "./../src/functions.js";
33

44
const themes = {

test/gist.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, it, expect, vi } from "vitest";
1+
import { describe, expect, it, vi } from "vitest";
22
import { getGist } from "./../src/gist.js";
33
import { $fetch } from "ofetch";
44

test/gistsList.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, it, expect, vi } from "vitest";
1+
import { describe, expect, it, vi } from "vitest";
22
import { getGists } from "../src/gistsList.js";
33
import { $fetch } from "ofetch";
44

test/pin.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, it, expect } from "vitest";
1+
import { describe, expect, it } from "vitest";
22
import { getPin } from "./../src/pin.js";
33

44
const fakeGist = {

0 commit comments

Comments
 (0)