Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internals upgrades (primary pr) #65

Merged
merged 32 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

128 changes: 0 additions & 128 deletions .eslintrc.json

This file was deleted.

7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"singleQuote": false,
"trailingComma": "all",
"jsxSingleQuote": false,
"printWidth": 100,
"arrowParens": "avoid"
}
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
[![codecov](https://codecov.io/github/Digital-Alchemy-TS/core/graph/badge.svg?token=IBGLY3RY68)](https://codecov.io/github/Digital-Alchemy-TS/core)
[![stars](https://img.shields.io/github/stars/Digital-Alchemy-TS/core)](https://github.com/Digital-Alchemy-TS/core)
![discord](https://img.shields.io/discord/1219758743848489147?label=Discord&logo=discord)

[![codecov](https://codecov.io/github/Digital-Alchemy-TS/core/graph/badge.svg?token=IBGLY3RY68)](https://codecov.io/github/Digital-Alchemy-TS/core)
[![version](https://img.shields.io/github/package-json/version/Digital-Alchemy-TS/core)](https://www.npmjs.com/package/@digital-alchemy/core)
---

# 🚀 Project Overview - Digital Alchemy TypeScript Libraries
Expand Down
152 changes: 152 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
import importPlugin from "eslint-plugin-import";
import jsonc from "eslint-plugin-jsonc";
import noUnsanitized from "eslint-plugin-no-unsanitized";
import simpleImportSort from "eslint-plugin-simple-import-sort";
import sortKeysFix from "eslint-plugin-sort-keys-fix";
import unicorn from "eslint-plugin-unicorn";
import prettier from "eslint-plugin-prettier";
import { fixupPluginRules } from "@eslint/compat";
import globals from "globals";
import tsParser from "@typescript-eslint/parser";
import sonarjs from "eslint-plugin-sonarjs";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});

export default [
sonarjs.configs.recommended,
{
plugins: {
import: fixupPluginRules(importPlugin),
jsonc,
"no-unsanitized": noUnsanitized,
"simple-import-sort": simpleImportSort,
"sort-keys-fix": sortKeysFix,
unicorn,
prettier,
},
languageOptions: {
globals: { ...globals.node },
},
},
...compat
.extends(
"plugin:@typescript-eslint/recommended",
"plugin:jsonc/recommended-with-jsonc",
"plugin:unicorn/recommended",
"plugin:prettier/recommended",
"plugin:@cspell/recommended",
)
.map(config => ({ ...config, files: ["src/**/*.ts", "testing/**/*.ts"] })),

// everything
{
files: ["src/**/*.ts", "testing/**/*.ts"],
languageOptions: {
parser: tsParser,
ecmaVersion: 5,
sourceType: "script",
parserOptions: {
project: ["tsconfig.json"],
},
},
rules: {
"prettier/prettier": "error",
"unicorn/switch-case-braces": "off",
"unicorn/prefer-module": "off",
"@typescript-eslint/no-magic-numbers": "warn",
"unicorn/no-object-as-default-parameter": "off",
"@cspell/spellchecker": ["warn", { checkComments: false, autoFix: true }],
"unicorn/no-null": "off",
"unicorn/no-empty-file": "off",
"sonarjs/sonar-no-fallthrough": "off",
"sonarjs/prefer-single-boolean-return": "off",
"unicorn/no-array-callback-reference": "off",
"sonarjs/prefer-nullish-coalescing": "off",
"unicorn/no-await-expression-member": "off",
"sonarjs/no-invalid-await": "off",
"sonarjs/no-nested-functions": "off",
"unicorn/no-useless-undefined": "off",
"@typescript-eslint/unbound-method": "error",
"import/no-extraneous-dependencies": ["error", { packageDir: "./" }],
"sonarjs/prefer-immediate-return": "off",
"unicorn/prevent-abbreviations": [
"error",
{
replacements: {
docs: false,
e: false,
dir: false,
i: false,
params: false,
props: false,
ref: false,
temp: false,
},
},
],
"no-case-declarations": "off",
"no-async-promise-executor": "off",
"unicorn/prefer-node-protocol": "off",
"unicorn/no-array-for-each": "off",
"unicorn/import-style": "off",
"sort-keys-fix/sort-keys-fix": "warn",
"unicorn/prefer-event-target": "off",
"simple-import-sort/imports": "warn",
"sonarjs/no-misused-promises": "off",
"sonarjs/no-commented-code": "off",
"sonarjs/todo-tag": "off",
"simple-import-sort/exports": "warn",
"no-console": ["error"],
"@typescript-eslint/no-unnecessary-type-constraint": "off",
"@typescript-eslint/no-unused-vars": ["warn", { varsIgnorePattern: "_|logger" }],
"@typescript-eslint/no-explicit-any": "error",
},
},
// tests
{
files: ["testing/**/*.ts"],
languageOptions: {
globals: { ...globals.jest },
parser: tsParser,
ecmaVersion: 5,
sourceType: "script",
parserOptions: {
project: ["tsconfig.spec.json"],
},
},
rules: {
"@typescript-eslint/unbound-method": "off",
"@typescript-eslint/no-magic-numbers": "off",
"sonarjs/no-duplicate-string": "off",
"sonarjs/no-commented-code": "off",
"sonarjs/no-dead-store": "off",
"sonarjs/no-unused-collection": "warn",
"unicorn/consistent-function-scoping": "off",
},
},
// module definitions
{
files: ["src/**/*.module.ts"],
languageOptions: {
parser: tsParser,
ecmaVersion: 5,
sourceType: "script",
parserOptions: {
project: ["tsconfig.json"],
},
},
rules: {
"@typescript-eslint/no-magic-numbers": "off",
},
},
];
Loading
Loading