包详细信息

@silvermine/eslint-config

silvermine1.9kMIT3.2.1

JS Code Standards for all SilverMine projects - eslint enforcement

eslint, eslintconfig

自述文件

Silvermine ESLint Rules

NPM Version License Build Status Dependency Status Dev Dependency Status Conventional Commits

What?

Shareable ESLint configuration for all Silvermine projects.

Why?

Because we need it. Whitespace errors are evil. As are the other hundreds of types of errors this protects us from.

Running ESLint

It is recommended to run ESLint via a NPM script in package.json with the command eslint . for projects that use this configuration.

Example:

{
   "scripts": {
      "eslint": "eslint ."
   }
}

Other Configuration Files Available

In addition to the ESLint rules, this package provides configuration for the following:

  • EditorConfig
    • Provides a default set of editor configuration values to use in Silvermine projects
    • Usage: Symlink the .editorconfig file to the root of your project and use the appropriate extension for your editor.
    • ln -s ./node_modules/@silvermine/eslint-config/.editorconfig
  • commitlint

    • Provides linting for commit messages of Silvermine projects
    • Usage: Add a commitlint.config.js file to the root of the project with the following and then set up commitlint in the project:

      'use strict';
      
      module.exports = {
         extends: [ '@silvermine/eslint-config/commitlint' ],
      };

Notes on Semantic Versioning

See the notes we made in eslint-plugin-silvermine regarding our use of version numbers here. The same decisions made for that repo also apply to this repo, basically for the same reasons.

What version should I use?

When choosing which version of this config to use, consider the following:

  • v2.x.x is the newest branch of our config, which allows for ES2015+ features, as well as TypeScript linting. On new projects, we recommend using this branch of the config.
  • v1.x.x is the legacy version of our eslint config. This should primarily be used in legacy es5 projects and with node version < 8.10.0. It does not allow for many es2015+ features, such as spread/rest operators and arrow functions.
    • The v1.x.x branch is not recommended for use in new projects and will only be minimally updated with bug fixes to support legacy code.

Updating ESLint

Updating ESLint in this project requires multiple steps across both this project and @silvermine/eslint-plugin:

  1. Open a PR to update ESLint in @silvermine/eslint-plugin
    • Note: Linting in the @silvermine/eslint-plugin PR will likely fail because @silvermine/eslint-plugin's version of @silvermine/eslint-config is incompatible with the new version of ESLint. That's ok. We will fix it soon in a subsequent step.
  2. After the PR from step 1 is merged, update @silvermine/eslint-plugin in @silvermine/eslint-config using a git+https + git hash URL. The git hash should point to the commit in @silvermine/eslint-plugin where you updated ESLint.
  3. Update ESLint in @silvermine/eslint-config. Open a PR that contains this update and the @silvermine/eslint-plugin update from step 2.
    • Note: All of the linting and tests in this build should pass.
  4. Publish a new version of @silvermine/eslint-config to the NPM registry
  5. Update @silvermine/eslint-config in @silvermine/eslint-plugin to the version that was just published
    • Note: All of the linting and tests in this build should now pass.
  6. Publish a new version of @silvermine/eslint-plugin to the NPM registry
  7. Update @silvermine/eslint-plugin in @silvermine/eslint-config using the version that was just published

License

This software is released under the MIT license. See the license file for more details.

更新日志

Changelog

All notable changes to this project will be documented in this file. See our coding standards for commit guidelines.

3.2.1 (2024-09-19)

Bug Fixes

  • ignore cdk.out directories (d072345)
  • remove invalid member-ordering value (0f0349d)

3.2.0 (2023-11-10)

Features

  • allow longer function declaration lines (11e4950)
  • fine tune naming conventions (#92) (ae13be5)
  • supporting linting of CJS file extensions (69effe6)

Bug Fixes

  • vue/multi-word-component-names should be universal (615ae24)

3.1.0 (2022-08-30)

Features

  • Add vue/setup-compiler-macros environment setting (90b1e78)
  • add linting rules for Vue components (2a18ccb)
  • Add separate eslint config for Vue2 code (1957b57)
  • Adjust rules for Vue 3 (cc24d4b)
  • Allow TypeScript type aliases (#73) (6f2a10c)
  • Override member-ordering rule (e9fc7a9)

Bug Fixes

  • ensure eslint does not ignore .vuepress directories (e1d7a18)

3.0.0-rc.0 (2020-01-22)

Marked as a major release because this version of the config relies on eslint@6. Previous versions relied on eslint@5. We're also using a newer version of node and NPM now, although that should not impact users.

Features

  • Remove no-restricted-syntax for JSX (f380c41)
  • upgrade @silvermine/eslint-plugin for eslint 6 upgrade (f24f857)

Bug Fixes

  • add config type to valid commitlint types (#61) (3229252)

2.3.0 (2019-09-03)

Features

2.2.1 (2019-04-05)

Bug Fixes

  • allow multiple cases for a single block inside switch statements (f657b77)

2.2.0 (2019-04-04)

Features

  • Error on 'var' in TypeScript files (fb319cf)

2.1.0 (2019-02-28)

Features

  • Turn off no-empty-function rule for tests (24d4800)
  • Adjust commitlint config for our standards (0034b96)
  • copy convention commitlint config (777f090)

2.0.0 (2019-02-08)

Version 2.0.0 was a major "rethink" of our rules, changing some past decisions, but primarily focusing on what we needed to change to add support for newer ES* features and TypeScript.