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

@alleyinteractive/eslint-config

v0.1.6

Published

Alley's ESLint configuration

Downloads

1,226

Readme

Alley's ESLint Configuration

standard README badge

Alley's standard ESLint configuration, which includes support for React, React Hooks, and TypeScript.

Background

This package leverages Airbnb's ESLint config and Airbnb Typescript along with Babel and Typescript ESLint parsers making it easy to configure JavaScript linting for projects that might also include React and TypeScript.

Releases

This package adheres to semantic versioning and is released on https://www.npmjs.com/.

Use

First, install the package from npm:

npm install --save-dev @alleyinteractive/eslint-config

Next, choose a configuration from the available ESLint configurations.

This package exports four ESLint configurations for usage.

  1. @alleyinteractive/eslint-config - Default configuration that supports React.
  2. @alleyinteractive/eslint-config/base - Base configuration similar to Airbnb's base configuration without supporting React plugins.
  3. @alleyinteractive/eslint-config/typescript - Typescript support without React plugin support.
  4. @alleyinteractive/eslint-config/typescript-react - Typescript and React support.

Then create an .eslintrc.json file in your project that extends the configuration:

  {
    "extends": ["@alleyinteractive/eslint-config"]
  }

Finally, add lint commands to your package.json:

{
  "scripts": {
    "lint": "eslint --ext .ts,.tsx,.js,.jsx .",
    "lint:fix": "eslint --ext .ts,.tsx,.js,.jsx --fix ."
  }
}

If you are resolving your modules with the ESLint webpack import resolver, you will need to add the eslint-import-resolver-webpack package and settings configuration in your project:

npm install --save-dev eslint-import-resolver-webpack

You will also need to add the following to the projects .eslintrc.json file:

  "settings": {
    "import/resolver": "webpack"
  },

TypeScript and Monorepo configuration

TypeScript

For TypeScript projects, you will need to explicitly include files you would like to lint in your tsconfig.json file. One way of doing this is to extend the base `tsconfig.json`` file and provide specific configurations for ESLint.

  1. Create a tsconfig.eslint.json file in your project that extends the base tsconfig.json file.
  2. Add the allowImportingTsExtensions and noEmit compiler options to the compilerOptions object since this configuration is not for compiling TypeScript.
  3. Add the files you would like to lint to the include array.

Example of a tsconfig.eslint.json file:

{
  "extends": "./tsconfig.json",
  "compilerOptions": {
    "allowImportingTsExtensions": true,
    "noEmit": true,
  },
  "include": [
    "../jest.config.js",
    "../config/webpack.config.ts",
    "../utils",
    "../index.ts",
    "../.eslintrc.js",
    "../utils/index.test.ts",
    "../utils/webpack.test.ts"
  ]
}

Monorepo

If you're using a monorepo, there may be additional steps to setup typed linting.

This package uses the typescript-eslint parser and plugin to support TypeScript.

ESLint requires a tsconfig.json file to be present in the root of the project and typescript-eslint needs to find the tsconfig.json file that is used for linting.

If you have a specific tsconfig file for ESLint such as a tsconfig.eslint.json file you will need to specify the path to this file in the parserOptions.project setting in your .eslintrc.json file.

  "parserOptions": {
    "project": "./tsconfig.eslint.json"
  }

More details: https://typescript-eslint.io/linting/typed-linting/monorepos

In some cases where there is no tsconfig file in your project root you may need to convert your eslintrc file to JavaScript to pass in the node global of __dirname to the parserOptions.tsconfigRootDir setting.

// eslintrc.js
module.exports = {
  extends: ['@alleyinteractive/eslint-config/typescript'],
+  parserOptions: {
+    project: `./tsconfig.eslint.json`,
+    tsconfigRootDir: __dirname,
+  },
};

From Source

To work on this repository:

git clone [email protected]:alleyinteractive/alley-scripts.git
cd packages/eslint-config
npm ci

In order to test the config with another project, you will need to point to this package, e.g.:

{
  "devDependences": {
    "@alleyinteractive/eslint-config": "file:../path/to/alley-scripts/packages/eslint-config"
  }
}

Then simply run npm install and npm will symlink to this folder, and you can work on your changes.

Changelog

This project keeps a changelog.

Development Process

See instructions above on installing from source. Pull requests are welcome from the community and will be considered for inclusion. Releases follow semantic versioning and are shipped on an as-needed basis.

Contributing

See our contributor guidelines for instructions on how to contribute to this open source project.

Project Structure

This is an npm package that is published to https://www.npmjs.com/. Dependencies are defined in package.json and the ESLint configuration is found in index.js.

Third-Party Dependencies

Third party dependencies are managed by npm and are visible in package.json. This package intends to reduce the dependency load on projects that use it by managing the dependencies itself.

Related Efforts

Maintainers

Alley logo

Contributors

Thanks to all of the contributors to this project.

License

This project is licensed under the GNU Public License (GPL) version 2 or later.