New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@mkvlrn/configurations

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

@mkvlrn/configurations

Opinionated configs for eslint, prettier, and typescript (tsconfig)

unpublished
latest
Source
npmnpm
Version
1.0.7
Version published
Maintainers
1
Created
Source

@mkvlrn/configurations

what

custom, opinionated configurations for eslint, prettier, and typescript (tsconfig.json) for my projects - aimed at modern, type-safe, non-spaghetti codebases

works in esm projects. not sure if it works in cjs, nor I'm willing to test it; you should be using esm

how

yarn add typescript eslint prettier @mkvlrn/configurations -D

then import the configurations from the package on your config files:

eslint.config.js

for base node, nest, or vite/react projects:

export { base as default } from "@mkvlrn/configurations/eslint";

for nextjs projects:

export { next as default } from "@mkvlrn/configurations/eslint";

if you want to add rules to the config, you export it as default while adding your rules to the config array:

import { base } from "@mkvlrn/configurations/eslint";

/** @type {import("typescript-eslint").ConfigWithExtends[]} */
export default {
  ...base, // or ...next for the nextjs config

  rules: {
    // add your custom rules here
    "no-console": "error",
    // or ignores
    "ignores": ["dist"],
  },
};
prettier.config.js

for all projects, using the config without modifying it:

export { base as default } from "@mkvlrn/configurations/prettier";

and if you want to modify any of the rules, you can do so:

import { base } from "@mkvlrn/configurations/prettier";

/** @type {import("prettier").Options} */
export default {
  ...base,

  // add your custom rules here
  printWidth: 100,
};
tsconfig.json

for base node, nest, or vite/react projects:

{
  "extends": "@mkvlrn/configurations/tsconfig-base",
  "compilerOptions": {
    // add your custom rules here
    "strict": true,
    "noUncheckedIndexedAccess": true,
  },
}

for nextjs projects:

{
  "extends": "@mkvlrn/configurations/tsconfig-next",
  "compilerOptions": {
    // add your custom rules here
    "strict": true,
    "noUncheckedIndexedAccess": true,
  },
}

details

eslint

two eslint flat configs: one for whatever node project (node, nest, react with vite, etc) and another for nextjs projects (which requires some special rules)

almost 100% positive it requires esm (type: module in package.json), I don't even know at this point, but if you use commonjs in 2024 you should be sent to the gulag

ALL rulesets/plugins are installed with the package, it's a flat config, so it's fancy that way

installing eslint separately is required

prettier

a packaged prettier configuration with some opinionated defaults

also brings tailwindcss support (order of classes) and imports sorting, both via plugins

installing prettier separately is required

typescript (tsconfig)

a packaged tsconfig.json with some opinionated defaults for both base node (which includes nest and vite/react projects) and nextjs projects

anything related to files except needs to be set: rootDir, outDir, baseUrl, paths, etc

this prevents path confusion because the "original" tsconfig will be in node_modules

defaults to noemit because I use esbuild so you might want to change that if you still want to use tsc like it's 2014

installing typescript separately is required

Keywords

eslint

FAQs

Package last updated on 15 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts