@snailicide/build-config
TypeScript icon, indicating that this package has built-in type declarations

1.4.0 • Public • Published

@snailicide/build-config 🐌

NPM License: MIT code style: prettier

Provides repository with base configurations that can be extended in new packages.


TypeScript ESLint RollupJS NPM Vite Vitest Zod

Repository

Author

👤 Gillian Tunney

Recommended package manager is pnpm

PNPM

@snailicide/build-config 🐌


This package provides reusable configuration files for commonly used tooling. It aims to define,extend, and manage build settings , ensuring consistency across different environments, projects and packages.

@snailicide/build-config contains configurations for:

Build Tooling

  • commitlintLint commit messages
  • @commitlint/config-conventionalShareable commitlint configuration
  • commitizenCommand-line utility to create commits with your rules.
  • eslintFind and fix problems in your JavaScript code.
  • typescript-eslintTooling that enables ESLint and Prettier to support TypeScript.
  • npmNode package manager
  • prettierOpinionated code formatter
  • rollupThe JavaScript module bundler
  • typedocDocumentation generator for TypeScript projects
  • typedoc-plugin-markdownGenerate TypeScript documentation as markdown
  • viteNext generation frontend tooling
  • vitestA Vite-native testing framework
  • vitepressVite & Vue powered static site generator

Eslint Plugins

  • typescript-eslintProvides linting rules for TypeScript code.
  • eslint-commentsEnforces best practices for ESLint directive comments.
  • filenames-simpleEnsures consistent and simple file naming conventions.
  • importSupports linting of ES2015+ import/export syntax, and prevent issues with misspelling of file paths and import names.
  • jsdocEnforces JSDoc comments and validates their syntax.
  • sortProvides rules for sorting various code elements, including: exports, object properties, TypeScript type properties, and string unions.
  • unused-importsIdentifies and removes unused imports in your code.
  • vitestContains linting rules for Vitest, a Vite-native testing framework.

Rollup Plugins

Installation

#pnpm
$ pnpm add @snailicide/build-config -D

#yarn
$ yarn add @snailicide/build-config -D

#npm
$ npm install @snailicide/build-config --development

Examples

Typescript

/* @file tsconfig.json */

{
  extends: '@snailicide/build-config/tsconfig-base',
  compilerOptions: {
    outDir: './../types',
    rootDir: '.',
    declarationDir: './../types',
  },
  exclude: ['**/*.test.ts'],
  include: ['**/*.ts', '**/*.cts', '**/*.mts'],
}

Eslint

/* @file eslint.config.js */

import { EsLint } from '@snailicide/build-config'

const FLAT_CONFIG = await EsLint.flatConfig()

export default [
  ...FLAT_CONFIG,
  {
    ignores: ['packages/**/docs/**/*'],
  },
]

Prettier

/* @file package.json (include prettier property) */
{
  prettier: '@snailicide/build-config/prettier',
}

OR

/** @file Prettier.config.cjs Extend the base configuration */
const { Prettier, merge } = require('@snailicide/build-config')
const options = {
  plugins: ['@shopify/prettier-plugin-liquid'],
  overrides: [
    {
      files: '*.liquid',
      options: {
        tabWidth: 2,
      },
    },
  ],
}
module.exports = merge(Prettier.config, options)

Typedoc

/** @file Typedoc.config.ts Basic Typedoc Config using Material Theme */
import { typedoc } from '@snailicide/build-config'
import url from 'node:url'
const __dirname = url.fileURLToPath(new URL('.', import.meta.url))

const typeDocConfig = typedoc.configMaterialTheme(__dirname, {})

export default typeDocConfig

OR

/** @file Typedoc.config.ts Basic Typedoc Markdown Config */
import path from 'node:path'
import url from 'node:url'
import { typedoc } from './types/index.js'
const __dirname = url.fileURLToPath(new URL('.', import.meta.url))

/** Custom properties to override */
const newTypeDocConfig = {
  githubPages: false,
  useCodeBlocks: true,
}
const typeDocConfig = {
  /** Markdown Configuration */
  ...typedoc.configMarkdown(__dirname, newTypeDocConfig),

  /** Entrypoint and excludes array is overwritten */
  entryPoints: [
    path.resolve(`${__dirname}/src/**/index.ts`),
    path.resolve(`${__dirname}/src/utilities.ts`),
  ],
  exclude: [path.resolve(`${__dirname}/src/index.ts`)],
}

export default typeDocConfig

Helpful Links

Package Sidebar

Install

npm i @snailicide/build-config

Weekly Downloads

1

Version

1.4.0

License

MIT

Unpacked Size

4.51 MB

Total Files

167

Last publish

Collaborators

  • gillian.tunney