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

eslint-config-coralloy

v0.5.0

Published

Coralloy ESLint config

Downloads

38

Readme

eslint-config-coralloy

Installation

pnpm i -D eslint-config-coralloy

// .eslintrc.js

module.exports = {
  extends: ["coralloy", "coralloy/vue-i18n"],
};
{
  rules: {
    "vue/no-unsupported-features": [
        "error",
        { version: require("vue").version },
      ],
  }
}

Import Patterns

We provide some patterns that you can import and use to configure the no-restricted-imports rule.

Example usage:

// .eslintrc.cjs
const {
  noDeepRelative,
  noLodash,
  // ...
} = require("eslint-config-coralloy/patterns");

module.exports = {
  // ...

  rules: {
    "no-restricted-imports": [
      "error",
      {
        patterns: [noDeepRelative, noLodash],
      },
    ],
  },
};

For the whole list of patterns and their descriptions, use IntelliSense capabilities of your editor or check the source code.

Migration from 0.4.x to 0.5.x

source.organizeImports was problematic in behavior and performance. We already have sorting/grouping through import-x plugin, so we only needed to be able to remove unused imports. To do so, we have added eslint-plugin-unused-imports as part of coralloy/import config. You can now remove source.organizeImports from .vscode/settings.json:

"editor.codeActionsOnSave": [
-  "source.organizeImports",
  "source.fixAll.eslint",
  "source.fixAll.stylelint"
],

The use of relative imports is now limited to one level at most, e.g. ./* and ../*, not ../../*. This is to enforce a more structured project and improve readability. If you need to import from a deeper level, consider using an alias. The new rules can't be fixed automatically, so you will need to make the necessary adjustments manually, if you have such imports. Example:

// inside src/components/something/foo-bar.vue
// need to import src/components/baz.vue
- import Baz from "../../baz.vue";
+ import Baz from "src/components/baz.vue";

// inside src/modules/some-module/sub-module/index.ts
// need to import src/modules/another-module/another.service.ts
- import AnotherService from "../../another-module/another.service";
+ import AnotherService from "src/modules/another-module/another.service";

To disable this specific pattern, or better yet, to add more patterns, see the Import Patterns section.

Migration from 0.3.x to 0.4.x

typescript-eslint has been updated to v8, so check typescript-eslint v8 announcement for more info.

We have switched from eslint-plugin-import to eslint-plugin-import-x. So, change import to import-x in your .eslintrc.js file and any ESLint disable comments. Example:

// .eslintrc.cjs
rules: {
-  "import/no-unresolved": "error",
+  "import-x/no-unresolved": "error",
}
- // eslint-disable-next-line import/no-unresolved
+ // eslint-disable-next-line import-x/no-unresolved

Migration from 0.2.x to 0.3.x

typescript-eslint has been updated to v7, so check typescript-eslint v7 announcement for more info.

Migration from 0.1.x to 0.2.x

You can now remove

{
  parserOptions: {
    // https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/parser#parseroptionstsconfigrootdir
    tsconfigRootDir: __dirname,
  },
}

as we now use project: true (https://typescript-eslint.io/packages/parser/#project) to autodetect the correct tsconfig file. tsconfigRootDir won't have any effect under the new setup, so removing it is just for the sake of clean code.

Dev notes

parserOptions.project will search for a tsconfig into the same folder as the eslint config file, since we suppose linting will be managed at root level and only one tsconfig will be present. It can be overridden in userland if needed to point to a different tsconfig.

We decided to go for eslint-config-coralloy instead of @coralloy/eslint-config due to consistency of the name to use when exporting multiple configs. Using eslint-config-coralloy the base can be included using coralloy and additional ones with coralloy/something. Using scoped modules would force to use the expanded form of @coralloy/eslint-config/something when using a config different than the default one, but only @coralloy for basic config.