Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-lit

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-lit - npm Package Compare versions

Comparing version 1.4.0 to 1.4.1

22

lib/rules/no-useless-template-literals.js

@@ -22,2 +22,3 @@ "use strict";

const isAttr = /^[^\.\?]/;
const endsWithAttr = /=['"]?$/;
//----------------------------------------------------------------------

@@ -27,13 +28,10 @@ // Helpers

const getExprAfterPosition = (pos, node) => {
var _a;
for (let i = 0; i < node.quasi.quasis.length; i++) {
const quasi = node.quasi.quasis[i];
if (quasi.loc &&
((pos.start.line > quasi.loc.start.line &&
pos.end.line < quasi.loc.end.line) ||
(pos.start.line === quasi.loc.start.line &&
pos.start.column >= quasi.loc.start.column) ||
(pos.start.line === quasi.loc.end.line &&
pos.start.column <= quasi.loc.end.column))) {
return (_a = node.quasi.expressions[i]) !== null && _a !== void 0 ? _a : null;
for (const expr of node.quasi.expressions) {
if (expr.loc &&
expr.loc.start.line === pos.start.line &&
expr.loc.start.column > pos.start.column &&
((expr.loc.end.line === pos.end.line &&
expr.loc.end.column <= pos.end.column) ||
expr.loc.end.line < pos.end.line)) {
return expr;
}

@@ -55,3 +53,3 @@ }

if (expr.type === 'Literal' &&
!node.quasi.quasis[i].value.raw.endsWith('=')) {
!endsWithAttr.test(node.quasi.quasis[i].value.raw)) {
context.report({

@@ -58,0 +56,0 @@ node: expr,

{
"name": "eslint-plugin-lit",
"version": "1.4.0",
"version": "1.4.1",
"description": "lit-html support for ESLint",

@@ -18,4 +18,3 @@ "main": "lib/index.js",

"dev": "npm run lint && npm run build && npm run test ",
"test": "nyc --reporter=html --reporter=text-summary mocha \"lib/test/**/*_test.js\"",
"test:coverage": "nyc report --reporter=text-lcov | coveralls",
"test": "nyc --reporter=html --reporter=text-summary --reporter=lcov mocha \"lib/test/**/*_test.js\"",
"format": "prettier --write \"src/**/*.ts\"",

@@ -22,0 +21,0 @@ "prepare": "npm run build",

@@ -1,31 +0,53 @@

# eslint-plugin-lit
<div align="center">
<img src="media/eslint-lit.svg" alt="Eslint + Lit" width="425" height="175" />
</div>
# `eslint-plugin-lit`
[![npm version](https://img.shields.io/npm/v/eslint-plugin-lit.svg?style=flat)](https://npmjs.org/package/eslint-plugin-lit 'View this project on npm')
[![Build Status](https://travis-ci.org/43081j/eslint-plugin-lit.svg?branch=master)](https://travis-ci.org/43081j/eslint-plugin-lit)
[![Build Status](https://travis-ci.com/43081j/eslint-plugin-lit.svg?branch=master)](https://travis-ci.com/43081j/eslint-plugin-lit)
[![Coverage Status](https://coveralls.io/repos/github/43081j/eslint-plugin-lit/badge.svg?branch=master)](https://coveralls.io/github/43081j/eslint-plugin-lit?branch=master)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[lit-html](https://github.com/polymer/lit-html) support for ESLint.
> ESLint plugin for [Lit](https://lit.dev/).
## Install
Assuming you already have ESLint installed, run:
```sh
# npm
npm install eslint-plugin-lit --save-dev
# yarn
yarn add eslint-plugin-lit --dev
```
$ npm i -D eslint eslint-plugin-lit
```
## Usage
Add `lit` to the plugins section of your `.eslintrc` file:
Then extend the recommended eslint config:
```json
```js
{
"plugins": ["lit"]
"extends": [
// ...
"plugin:lit/recommended"
]
}
```
Configure your rules like so:
### Custom Configuration
```json
If you want more fine-grained configuration, you can instead add a snippet like this to your ESLint configuration file:
```js
{
"plugins": [
// ...
"lit"
],
"rules": {
"lit/rule-name": "error"
// ...
"lit/no-legacy-template-syntax": "error",
"lit/no-template-arrow": "warn"
}

@@ -35,10 +57,31 @@ }

## Configuration
## List of supported rules
You may also extend the recommended configuration like so:
- [lit/attribute-value-entities](docs/rules/attribute-value-entities.md)
- [lit/binding-positions](docs/rules/binding-positions.md)
- [lit/no-duplicate-template-bindings](docs/rules/no-duplicate-template-bindings.md)
- [lit/no-invalid-escape-sequences](docs/rules/no-invalid-escape-sequences.md)
- [lit/no-invalid-html](docs/rules/no-invalid-html.md)
- [lit/no-legacy-template-syntax](docs/rules/no-legacy-template-syntax.md)
- [lit/no-private-properties](docs/rules/no-private-properties.md)
- [lit/no-property-change-update](docs/rules/no-property-change-update.md)
- [lit/no-template-arrow](docs/rules/no-template-arrow.md)
- [lit/no-template-bind](docs/rules/no-template-bind.md)
- [lit/no-template-map](docs/rules/no-template-map.md)
- [lit/no-useless-template-literals](docs/rules/no-useless-template-literals.md)
- [lit/no-value-attribute](docs/rules/no-value-attribute.md)
- [lit/quoted-expressions](docs/rules/quoted-expressions.md)
```json
## Shareable configurations
### Recommended
This plugin exports a `recommended` configuration that enforces Lit good practices.
To enable this configuration use the `extends` property in your `.eslintrc` config file:
```js
{
"extends": ["plugin:lit/recommended"],
"env": {"browser": true}
"extends": ["eslint:recommended", "plugin:lit/recommended"]
}

@@ -49,11 +92,11 @@ ```

We highly recommend you also depend on
We **highly** recommend you also depend on
[eslint-plugin-wc](https://github.com/43081j/eslint-plugin-wc) as it will
provide additional rules for web components in general:
```bash
```sh
npm i -D eslint-plugin-wc
```
Config:
Then extend the recommended eslint config:

@@ -65,22 +108,8 @@ ```json

"plugin:lit/recommended"
],
"env": {"browser": true}
]
}
```
## Supported Rules
## License
- [lit/attribute-value-entities](docs/rules/attribute-value-entities.md)
- [lit/binding-positions](docs/rules/binding-positions.md)
- [lit/no-duplicate-template-bindings](docs/rules/no-duplicate-template-bindings.md)
- [lit/no-invalid-escape-sequences](docs/rules/no-invalid-escape-sequences.md)
- [lit/no-invalid-html](docs/rules/no-invalid-html.md)
- [lit/no-legacy-template-syntax](docs/rules/no-legacy-template-syntax.md)
- [lit/no-private-properties](docs/rules/no-private-properties.md)
- [lit/no-property-change-update](docs/rules/no-property-change-update.md)
- [lit/no-template-arrow](docs/rules/no-template-arrow.md)
- [lit/no-template-bind](docs/rules/no-template-bind.md)
- [lit/no-template-map](docs/rules/no-template-map.md)
- [lit/no-useless-template-literals](docs/rules/no-useless-template-literals.md)
- [lit/no-value-attribute](docs/rules/no-value-attribute.md)
- [lit/quoted-expressions](docs/rules/quoted-expressions.md)
MIT
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc