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

@oat-sa/eslint-config-tao

v4.0.0

Published

Shareable eslint configurations package for `oat-sa` projects.

Downloads

2,927

Readme

eslint-config-tao

Shareable eslint configurations package for oat-sa projects.

Concept

All extensions, projects and libraries (oat-sa wide) should use the shared config as a basis. Current extension contains a pack of shareable configs depending on the stack and target. See this to understand what a shareable config is.

This package includes legacy configs (eslint version < 9) and the new flat configs (eslint version >=9).

1. Examples of usage for the new flat configs (eslint v9 required)

Note about Prettier

If you are using Prettier in your project (you should), install eslint-config-prettier and use it as you will see in the examples: it should always be the last config in the array. This will turn off rules that conflict with our Prettier config

In your eslint.config.js file you can compose flat configs easily. To use the svelte flat config do this:

  1. For a new project using vite and vitest
import configs from '@oat-sa/eslint-config-tao/flat/svelte';
import eslintConfigPrettier from 'eslint-config-prettier';

/** @type { import("eslint").Linter.FlatConfig[] } */
export default [...configs['flat/svelte-base'], ...configs['flat/vitest'], eslintConfigPrettier];
  1. For a project using babel and jest
import configs from '@oat-sa/eslint-config-tao/flat/svelte';
import eslintConfigPrettier from 'eslint-config-prettier';

/** @type { import("eslint").Linter.FlatConfig[] } */
export default [...configs['flat/svelte-base'], ...configs['flat/babel-parser'] ...configs['flat/jest'], eslintConfigPrettier];

Note: the Svelte flat config is currently the only flat config in this package

2. Examples of usage for legacy configs

Use shareable eslint configurations via the extends config property.

  1. Default configuration. Edit the .eslintrc.js of your project:

    module.exports = {
        extends: '@oat-sa/eslint-config-tao'
    };
  2. Configuration for AMD modules:

    module.exports = {
        extends: '@oat-sa/eslint-config-tao/amd'
    };
  3. Configuration for svelte with jest rules:

    module.exports = {
        extends: '@oat-sa/eslint-config-tao/svelte-jest-legacy'
    };
  4. Configuration for svelte with vitest rules:

    module.exports = {
        extends: '@oat-sa/eslint-config-tao/svelte-vitest-legacy'
    };
  5. Configuration for node:

    module.exports = {
        extends: '@oat-sa/eslint-config-tao/node'
    };
  6. Configuration for cypress:

    module.exports = {
        extends: '@oat-sa/eslint-config-tao/cypress'
    };

Flat config notes:

If you install eslint v9 and you still want to use the legacy config, in your package.json you can use this flag:

 "lint": "ESLINT_USE_FLAT_CONFIG=false eslint .

If you want to stay on eslint v8.57 (below v8.57 flat config doesn't work) but use the flat config, in your package.json you can do :

 "lint": "ESLINT_USE_FLAT_CONFIG=true eslint .

Common issues migrating to version 4.0.0:

1- If you see this error: ERR_PACKAGE_PATH_NOT_EXPORTED

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './svelte' is not defined by "exports" in /[some_path]/node_modules/@oat-sa/eslint-config-tao/package.json
Referenced from: /[some_path]/.eslintrc.cjs

It means you are coming from a version lower than 4.0.0 and you need to switch the config name you are using in your .eslintrc.cjs file from

extends: ['@oat-sa/eslint-config-tao/svelte'],

to

extends: ['@oat-sa/eslint-config-tao/svelte-jest-legacy'],

or

extends: ['@oat-sa/eslint-config-tao/svelte-vitest-legacy'],

2- If you use the cypress config:

Make sure that you use this order extending configs (the svelte config should be after the cypress config):

extends: ['@oat-sa/eslint-config-tao/cypress', '@oat-sa/eslint-config-tao/svelte-jest-legacy']

Otherwise, you'll get this error in every .svelte file:

1:0  error  Parsing error: This experimental syntax requires enabling one of the following parser plugin(s): "jsx", "flow", "typescript". (1:0)

3- If you get dependency conflicts when instaling the package

If you are using eslint 8, you will need to update it to version 8.57.0 in order to avoid those dependency issues when running npm install. Also, configs in this package use es2024 and this is available in eslint 8.57.0.

Change log

See changelog here