0.0.5 • Published 10 months ago

sysgears-linter-configs v0.0.5

Weekly downloads
-
License
UNLICENSED
Repository
github
Last release
10 months ago

Linter configurations package.

This package provides a set of ESLint configurations designed to enforce consistent coding styles and best practices across your JavaScript or TypeScript projects.

Installation:

You can install the package via npm or yarn:

npm install --save-dev sysgears-linter-configs

or

yarn add --dev sysgears-linter-configs

Usage:

To use the ESLint configurations provided by this package, use generateServerEslintConfig and generateWebEslintConfig, provided by this package. This functions accepts one argument - finalExcludeRegex, which can be generated by function createExcludeRegex, provided by this package.

const { createExcludeRegex } = require('sysgears-linter-configs/utils');

const EXCLUDE_NAMES_NAMING_CONVENTION_WORDS = [];
const EXCLUDE_NAMES_NAMING_CONVENTION_REGEXPS = [];

const finalExcludeRegex = createExcludeRegex({
  namingConventionRegexps: EXCLUDE_NAMES_NAMING_CONVENTION_REGEXPS,
  namingConventionWords: EXCLUDE_NAMES_NAMING_CONVENTION_WORDS,
});

Resulting config may look like this:

const generateServerEslintConfig = require('sysgears-linter-configs/eslint.server');
const { createExcludeRegex } = require('sysgears-linter-configs/utils');

const EXCLUDE_NAMES_NAMING_CONVENTION_WORDS = [];
const EXCLUDE_NAMES_NAMING_CONVENTION_REGEXPS = [];

const finalExcludeRegex = createExcludeRegex({
  namingConventionRegexps: EXCLUDE_NAMES_NAMING_CONVENTION_REGEXPS,
  namingConventionWords: EXCLUDE_NAMES_NAMING_CONVENTION_WORDS,
});

const serverConfig = generateServerEslintConfig(finalExcludeRegex);

module.exports = {
  ...serverConfig,
  parserOptions: {
    ...serverConfig.parserOptions,
    tsconfigRootDir: __dirname,
    project: 'tsconfig.json',
  },
};