Skip to content

Commit

Permalink
Update eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
jakebailey committed Dec 9, 2024
1 parent 1325d78 commit 4af20bc
Show file tree
Hide file tree
Showing 6 changed files with 313 additions and 306 deletions.
109 changes: 0 additions & 109 deletions .eslintrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion .ncurc.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
target: (dependencyName, [{ semver, version, operator, major, minor, patch, release, build }]) => {
if (dependencyName === "eslint") return "minor";
if (dependencyName === "@types/node") return "minor";
if (major === "0") return "minor";
return "latest";
Expand Down
136 changes: 136 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
// @ts-check
import eslint from "@eslint/js";
import eslintPlguinSimpleImportSort from "eslint-plugin-simple-import-sort";
import eslintPluginUnicorn from "eslint-plugin-unicorn";
import globals from "globals";
import tseslint from "typescript-eslint";

export default tseslint.config(
{
files: ["**/*.{ts,tsx,cts,mts,js,cjs,mjs}"],
},
{
ignores: [
"**/dist/**",
"**/node_modules/**",
"bin/**",
"coverage/**",
],
},
eslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
...tseslint.configs.stylistic,
eslintPluginUnicorn.configs["flat/recommended"],
{
languageOptions: {
parserOptions: {
warnOnUnsupportedTypeScriptVersion: false,
ecmaVersion: "latest",
sourceType: "module",
project: true,
},
globals: globals.node,
},
plugins: {
"simple-import-sort": eslintPlguinSimpleImportSort,
},
},
{
"rules": {
"eqeqeq": "error",
"no-constant-condition": "off",
"no-inner-declarations": "off",
"no-undef": "off",
"no-unused-vars": "off",
"no-empty": "off",
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error",
"@typescript-eslint/no-import-type-side-effects": "error",
// In theory good, but less good when declaring a new interface and
// stopping to think about its contents.
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/no-unused-vars": ["warn", { "argsIgnorePattern": "^_", "varsIgnorePattern": "^_" }],
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/no-empty-object-type": "off",
"@typescript-eslint/require-await": "off",
"@typescript-eslint/restrict-template-expressions": "off",
"@typescript-eslint/naming-convention": [
"error",
{
"selector": [
"classProperty",
"typeProperty",
"parameterProperty",
"classMethod",
"typeMethod",
"accessor",
],
"modifiers": ["private"],
"leadingUnderscore": "require",
"format": ["camelCase"],
"filter": {
"regex": "^(test_| )",
"match": false,
},
},
{
"selector": [
"classProperty",
"typeProperty",
"parameterProperty",
"classMethod",
"typeMethod",
"accessor",
],
"modifiers": ["protected"],
"leadingUnderscore": "allow",
"format": ["camelCase"],
"filter": {
"regex": "^(test_| )",
"match": false,
},
},
{
"selector": [
"classProperty",
"typeProperty",
"parameterProperty",
"classMethod",
"typeMethod",
"accessor",
],
"modifiers": ["public"],
"leadingUnderscore": "forbid",
"format": ["camelCase"],
"filter": {
"regex": "^(test_| )",
"match": false,
},
},
],
"unicorn/catch-error-name": "off",
"unicorn/filename-case": "off",
"unicorn/no-array-callback-reference": "off",
"unicorn/no-await-expression-member": "off",
"unicorn/no-useless-undefined": "off",
"unicorn/prefer-top-level-await": "off", // Reenable once Node 12 is dropped.
"unicorn/prevent-abbreviations": "off",
"unicorn/switch-case-braces": "off",
"unicorn/prefer-string-replace-all": "off", // Bad suggestion for old targets
},
},
{
files: [
".ncurc.cjs",
"eslint.config.mjs",
],
extends: [tseslint.configs.disableTypeChecked],
},
);
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
"@types/adm-zip": "^0.5.7",
"@types/node": "^18.19.67",
"@types/semver": "^7.5.8",
"@typescript-eslint/eslint-plugin": "^8.17.0",
"@typescript-eslint/parser": "^8.17.0",
"dprint": "^0.47.6",
"eslint": "^8.57.1",
"eslint": "^9.16.0",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-unicorn": "^56.0.1",
"globals": "^15.13.0",
"rimraf": "^6.0.1",
"typescript": "^5.7.2"
"typescript": "^5.7.2",
"typescript-eslint": "^8.17.0"
},
"scripts": {
"build": "tsc",
Expand Down
Loading

0 comments on commit 4af20bc

Please sign in to comment.