npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@front-utils/linter

v1.0.1

Published

Configuration files for linting

Downloads

357

Readme

Front-utils/linter

The repository contains configuration files for setting up ESLint in the project.

Note: Only ftat eslint configutation

Installation

You can install the package as follows:

npm install @front-utils/linter --save-dev

# or

yarn add @front-utils/linter -D

# or

bun add @front-utils/linter --dev

Usage (ESM)

import {
    utils, // utilities
    configs // preconfigured configs
} from "@front-utils/linter";

create alias

import { utils } from "@front-utils/linter";
import importPlugin from 'eslint-plugin-import';

export const fullEslintAliases = [
    ...utils.createEslintAlias({ 
        name: 'pkg', 
        basePath: '.', 
        config: {
            utils: 'src/infrastructure/utils', // @alias: @pkg/utils -> src/infrastructure/utils
            models: 'src/data/models' // @alias: @pkg/models -> src/data/models
        } 
    }),
    ...utils.createEslintAlias({ name: 'api', basePath: '.', config: {} }),
];

const importPluginConfig = {
    plugins: {
        import: importPlugin,
    },
    settings: {
        'import/resolver': {
            alias: {
                map       : fullEslintAliases,
                extensions: ['.ts', '.tsx', '.json', '.js', 'jsx'],
            },
            ...
        },
    }
};

create eslint config

import { utils } from "@front-utils/linter";

/** 
The config.types parameter is an array that can contain the following keys:
 - babel: include babel settings
 - react: indicates whether React support is enabled.
 - test: indicates whether testing support is enabled.
 - ts: indicates whether TypeScript support is enabled.
*/
const eslintConfig = utils.createEslintConfig({
    types: ['ts', 'babel', 'react', 'test'],
    ...{
        ignores: [],
        files: []
    } /** any eslint rule */
}),

| base rules | included plugins | | --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | with any config.types | @eslint/js eslint-plugin-compat eslint-plugin-optimize-regex eslint-plugin-promise eslint-plugin-sonarjs eslint-plugin-filenames eslint-plugin-import eslint-plugin-jsx-a11y |

add plugins with config.types

| config.types | included plugins | | ------------ | ---------------------------------------------------- | | test | eslint-plugin-testing-library eslint-plugin-jest-dom | | ts | typescript-eslint | | react | eslint-plugin-react-hooks eslint-plugin-react | | babel | @babel/eslint-parser |

rewrite the rules in all plugins.

import { utils } from '@front-utils/linter';

export default [
    ...utils.createEslintConfig({
        ignores: ["**/*" ,"!src/**/*"]
    })
]; 

| alias | is equal | | -------- | -------------------------------------------------------------------- | | standart | utils.createEslintConfig() | | test | utils.createEslintConfig({types: ['test'],}) | | ts | utils.createEslintConfig({types: ['ts'],}) | | react | utils.createEslintConfig({types: ['ts', 'react'],}) | | monorepo | utils.createEslintConfig({types: ['test', 'babel', 'ts', 'react'],}) |

standart config

alias for utils.createEslintConfig()

npm install @front-utils/linter @eslint/js eslint-plugin-compat eslint-plugin-optimize-regex eslint-plugin-promise eslint-plugin-sonarjs eslint-plugin-filenames  eslint-plugin-import eslint-plugin-jsx-a11y --save-dev
// eslint.config.js
import {
    configs,
} from "@front-utils/linter";

export default configs.standart;

ts config

alias for utils.createEslintConfig({types: ['ts'],})

npm install @front-utils/linter @eslint/js typescript-eslint eslint-plugin-compat eslint-plugin-optimize-regex eslint-plugin-promise eslint-plugin-sonarjs eslint-plugin-filenames  eslint-plugin-import eslint-plugin-jsx-a11y --save-dev
// eslint.config.js
import {
    configs,
} from "@front-utils/linter";

export default configs.ts;

react config

alias for utils.createEslintConfig({types: ['ts', 'react'],})

npm install @front-utils/linter @eslint/js typescript-eslint eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-compat eslint-plugin-optimize-regex eslint-plugin-promise eslint-plugin-sonarjs eslint-plugin-filenames  eslint-plugin-import eslint-plugin-jsx-a11y globals --save-dev
// eslint.config.js
import {
    configs,
} from "@front-utils/linter";

export default configs.react;

test config

alias for utils.createEslintConfig({types: ['test'],})

npm install @front-utils/linter @eslint/js eslint-plugin-testing-library eslint-plugin-jest-dom --save-dev
// eslint.config.js
import {
    configs,
} from "@front-utils/linter";

export default configs.test;

monorepo config

alias for utils.createEslintConfig({types: ['test', 'babel', 'ts', 'react'],})

npm install @front-utils/linter @eslint/js typescript-eslint eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-compat eslint-plugin-optimize-regex eslint-plugin-promise eslint-plugin-sonarjs eslint-plugin-filenames  eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-testing-library eslint-plugin-jest-dom @babel/eslint-parser globals --save-dev
// eslint.config.js
import {
    configs,
} from "@front-utils/linter";

export default configs.monorepo;

configured config for use in a monorepo (expects the presence of tsconfig.json, babel.config.js files in the project root, and uses react, typescript technologies)