@esri/eslint-plugin-calcite-components

1.1.0 • Public • Published

@esri/eslint-plugin-calcite-components

ESLint rules specific to Stencil JS projects.

Installation

Install the following deps in your stencil project:

npm i @esri/eslint-plugin-calcite-components --save-dev

Usage

Add or update the .eslintrc.json configuration file:

{
  "parserOptions": {
    "project": "./tsconfig.json"
  },
  "extends": ["plugin:@esri/calcite-components/recommended"]
}

Add a new lint script to package.json:

{
  "scripts": {
    "lint": "eslint src/**/*{.ts,.tsx}"
  }
}

Then you can run the linter:

npm run lint

Supported Rules

This rule helps prevent usage of specific events and allows suggesting alternatives.

This rule catches props/attributes that should be in the encapsulated HTML structure and not on the host element.

This ensures the node passed into the ref callback is in sync with its JSX attributes/properties when invoked.

This rule helps enforce the payload type to EventEmitters to avoid misleading any type on the CustomEvent detail object.

This rule catches boolean props that are initialized in a way that does not conform to the HTML5 spec.

Recommended rules

{
  "@esri/calcite-components/ban-props-on-host": "error",
  "@esri/calcite-components/enforce-ref-last-prop": "error",
  "@esri/calcite-components/require-event-emitter-type": "error",
  "@esri/calcite-components/strict-boolean-attributes": "error"
}

Contributing

We welcome contributions to this project. See CONTRIBUTING.md for an overview of contribution guidelines.

License

COPYRIGHT © 2023 Esri

All rights reserved under the copyright laws of the United States and applicable international laws, treaties, and conventions.

This material is licensed for use under the Esri Master License Agreement (MLA), and is bound by the terms of that agreement. You may redistribute and use this code without modification, provided you adhere to the terms of the MLA and include this copyright notice.

See use restrictions at http://www.esri.com/legal/pdfs/mla_e204_e300/english

For additional information, contact: Environmental Systems Research Institute, Inc. Attn: Contracts and Legal Services Department 380 New York Street Redlands, California, USA 92373 USA

email: contracts@esri.com

Readme

Keywords

none

Package Sidebar

Install

npm i @esri/eslint-plugin-calcite-components

Weekly Downloads

18

Version

1.1.0

License

SEE LICENSE.md

Unpacked Size

15.6 kB

Total Files

4

Last publish

Collaborators

  • kit12303
  • jordantsanz
  • allieraney
  • robert.vo
  • noahmulfinger
  • ssylvia
  • paulcpederson
  • jgravois
  • patrickarlt
  • nixta
  • odoe
  • jwasilgeo
  • tomwayson
  • benstoltz
  • dbouwman
  • thollingshead
  • hhkaos
  • dpaddock
  • esri_dev
  • driskull
  • jamin415
  • katelynseitz
  • jpurusho
  • rlibed
  • mtschudi
  • ajturner
  • gavinr
  • kellyhutchins
  • mjuniper
  • john4818
  • pr3tori4n
  • gbrown-gis
  • haoliang
  • macandcheese
  • jcfranco
  • alan0002
  • richgwozdz
  • rweber.esri
  • vivzhang
  • juliannemarik
  • drspacemanphd