eslint: Added Backend only ESLint config + v1.1.1 release

This commit is contained in:
Jyotirmoy Bandyopadhayaya 2023-07-01 18:13:51 +05:30
parent e43c067ab1
commit 765371c2fd
Signed by: bravo68web
GPG Key ID: F5671FD7BCB9917A
5 changed files with 109 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@bravo68web/eslint-config",
"version": "1.1.0",
"version": "1.1.1",
"description": "The official ESLint configuration for bravo68web projects",
"license": "MIT",
"author": "Bravo68web <hi@b68.dev> (https://github.com/bravo68web/)",

View File

@ -0,0 +1,92 @@
import type { Linter } from "eslint";
const config: Linter.Config = {
env: {
browser: true,
es6: true,
node: true,
},
extends: [
"eslint:recommended",
"plugin:regexp/recommended",
"plugin:unicorn/recommended",
"plugin:sonarjs/recommended",
"plugin:security/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/eslint-recommended",
],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: "latest",
},
plugins: [
"regexp",
"jsx-a11y",
"autofix",
"sonarjs",
"unicorn",
"@typescript-eslint",
"simple-import-sort",
],
rules: {
quotes: [
2,
"double",
{
avoidEscape: true,
},
],
// Eslint
"prefer-arrow-callback": 2,
semi: [2, "always"],
// Import sorting
"simple-import-sort/imports": 2,
"simple-import-sort/exports": 2,
// SonarJS
"sonarjs/no-duplicate-string": 0,
// Unicorn
"unicorn/no-null": 0,
"unicorn/prefer-module": 0,
"unicorn/no-useless-undefined": 0,
"unicorn/prevent-abbreviations": 0,
"unicorn/no-await-expression-member": 0,
// Typescript
"@typescript-eslint/no-namespace": 0,
"@typescript-eslint/no-misused-promises": 0,
"@typescript-eslint/no-unused-vars": [2],
"@typescript-eslint/no-unsafe-call": 0,
"@typescript-eslint/no-unsafe-assignment": 0,
"@typescript-eslint/no-unsafe-member-access": 0,
},
overrides: [
{
files: ["*.js", "*.cjs"],
rules: {
"@typescript-eslint/no-var-requires": 0,
},
},
{
files: ["*.js", "*.ts", "*.cjs", "*.mjs", "*.mts", "*.cts"],
rules: {
"simple-import-sort/imports": [
"error",
{
groups: [
["dotenv/config"],
["^node:"],
["^@?\\w"],
["^[\\w]"],
["^"],
["^\\."],
],
},
],
},
},
],
};
export default config;

View File

@ -0,0 +1,14 @@
import { describe } from "vitest";
import config from "../src/backend";
import { checkLintingErrors, checkValidity, createEngine } from "./utils";
describe("Default Configuration", () => {
const engine = createEngine(config);
// Check if the script is valid
checkValidity(engine);
// Check if the script has any linting errors
checkLintingErrors(engine);
});

View File

@ -1,6 +1,6 @@
{
"name": "@bravo68web/prettier-config",
"version": "1.1.0",
"version": "1.1.1",
"description": "The official Prettier configuration for bravo68web projects",
"author": "Bravo68web <hi@b68.dev> (https://github.com/bravo68web/)",
"homepage": "https://github.com/bravo68web/nodejs-config#readme",

View File

@ -1,6 +1,6 @@
{
"name": "@bravo68web/tsconfig",
"version": "1.1.0",
"version": "1.1.1",
"description": "Typescript config for bravo68web, ensure the consistency of code quality.",
"license": "MIT",
"author": "Bravo68web <hi@b68.dev> (https://github.com/bravo68web/)",