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

@bassist/eslint

v0.6.1

Published

Flat ESLint config for JavaScript, TypeScript, Vue, React, Svelte, Prettier and so on by @chengpeiquan .

Downloads

87

Readme

@bassist/eslint

Flat ESLint config for ESLint by @chengpeiquan .

Usage

With npm(or yarn, or pnpm):

npm install -D eslint @bassist/eslint

Yeah, this is a ESLint configuration, so you need to install ESLint at the same time.

If using TypeScript's Lint configuration, also make sure TypeScript is installed.

Requires ESLint >= 8.0.0 , and TypeScript >= 5.0.0 .

Configuration File

Create a configuration file named eslint.config.js in the root path of the project.

If using another filename (e.g. eslint.config.cjs or eslint.config.mjs), please use the --config command line option to specify your config.

Simple Usage

You can import the desired presets depending on the type of project, please remember that each config is an array, and the default export is also an array.

// eslint.config.js
import { prettier, vue } from '@bassist/eslint'
export default [...prettier, ...vue]

Yeah, the config file cannot be a file name such as .eslintrc.js or .eslintrc.json and so on, see Migration .

Next, add the "type": "module" setting and a lint script in the project's package.json.

{
  "type": "module",
  "scripts": {
    "lint": "eslint src"
  }
}

In lint script, src is your source code folder, please adjust it according to the actual situation.

You can run npm run lint to start linting the code.

Usage with type checking

If you need to adjust or add configuration, it is recommended to wrap the configuration through the defineFlatConfig of defineConfig (Alias) API to get a better configuration experience.

Remember use // @ts-check at the first line in your eslint.config.js .

// @ts-check
import { defineFlatConfig, prettier, vue } from '@bassist/eslint'

export default defineFlatConfig([
  ...prettier,
  ...vue,
  {
    rules: {
      // By default, this rule is `off`
      'vue/component-tags-order': 'error',
    },
    ignores: ['examples'],
  },
])

See eslint-define-config to learn more.

VS Code Setting

Please turn on this setting, which can solve VS Code's error reporting to eslint.config.js.

{
  "eslint.experimental.useFlatConfig": true
}

In order not to affect other irrelevant projects, it is highly recommended that this setting only take effect in the workspace, not globally. So please fill it into .vscode/settings.json.

ESLint Config

This package exports some config of ESLint, which can be imported via named.

Helpers

Helper functions and types for type checking are provided here (See: Usage with type checking).

Languages

Frameworks

Typescript rules are built-in when using framework presets.

Formatters

Others

Note

  1. ESLint lower than 8.x does not support this configuration file.
  2. In ESLint 8.x, VS Code needs to enable special configuration to use this configuration file normally, see: VS Code Setting
  3. The lint script no longer supports the --ext option, see: #16991 .
  4. Currently this package is not friendly to CommonJS, please enable "type": "module" to support ES Module, see: Configuration .

Migration

If you want to migrate your ESLint configuration file from the eslintrc format (typically configured in .eslintrc.js or .eslintrc.json files) to the new flat config format (typically configured in an eslint.config.js file).

See: Configuration Migration Guide

Related Reading:

Release Notes

Please refer to CHANGELOG for details.

License

MIT License © 2023-PRESENT chengpeiquan