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

eslint-plugin-escompat

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-escompat - npm Package Compare versions

Comparing version 3.2.0 to 3.3.0

59

lib/index.js

@@ -5,3 +5,3 @@ const path = require('path')

const {version,homepage} = require('../package.json')
const createRule = (name, browserstring, description, {fixable = null, schema = []} = {}) => {
const createRule = (name, browserstring, description, {fixable = null, schema = [], ts = null} = {}) => {
module.exports.rules[name] = {

@@ -31,2 +31,13 @@ meta: {

}
if (ts) {
const configName = `typescript-${ts}`
if (!module.exports.configs[configName]) {
if (ts === 2016) {
module.exports.configs[configName] = {extends: [`escompat:recommended`], rules: {}}
} else {
module.exports.configs[configName] = {extends: [`escompat:typescript-${ts-1}`], rules: {}}
}
}
module.exports.configs[configName].rules[`escompat/${name}`] = 'off'
}
}

@@ -39,8 +50,8 @@

// ES2016
createRule('no-exponentiation-operator', 'chrome < 52, edge < 14, firefox < 52, safari < 10.1', 'disallow use of exponentiation operator (**)')
createRule('no-exponentiation-operator', 'chrome < 52, edge < 14, firefox < 52, safari < 10.1', 'disallow use of exponentiation operator (**)', {ts: 2016})
// ES2018
createRule('no-async-iteration', 'edge < 79, safari < 12, firefox < 57, chrome < 63', 'disallow the use of `for await of` style loops')
createRule('no-async-generator', 'edge < 79, safari < 12, firefox < 57, chrome < 63', 'disallow the use of async generator functions')
createRule('no-object-rest-spread', 'edge < 79, safari < 11.1, firefox < 55, chrome < 60', 'disallow object rest/spread patterns')
createRule('no-async-iteration', 'edge < 79, safari < 12, firefox < 57, chrome < 63', 'disallow the use of `for await of` style loops', {ts: 2018})
createRule('no-async-generator', 'edge < 79, safari < 12, firefox < 57, chrome < 63', 'disallow the use of async generator functions', {ts: 2018})
createRule('no-object-rest-spread', 'edge < 79, safari < 11.1, firefox < 55, chrome < 60', 'disallow object rest/spread patterns', {ts: 2018})
createRule('no-regexp-s-flag', 'edge < 79, safari < 11.1, firefox < 78, chrome < 62', 'disallow the use of the RegExp `s` flag')

@@ -51,18 +62,18 @@ createRule('no-regexp-lookbehind', 'edge < 79, safari > 0, firefox < 78, chrome < 62', 'disallow the use of RegExp lookbehinds')

// ES2019
createRule('no-optional-catch', 'edge < 79, safari < 11.1, firefox < 58, chrome < 66', 'always require catch() to have an argument')
createRule('no-optional-catch', 'edge < 79, safari < 11.1, firefox < 58, chrome < 66', 'always require catch() to have an argument', {ts: 2019})
// ES2020
createRule('no-dynamic-imports', 'edge < 79, safari < 11, firefox < 67, chrome < 63', 'disallow dynamic import statements')
createRule('no-optional-chaining', 'edge < 80, safari < 13.1, firefox < 72, chrome < 80', 'disallow the .? optional chaning operator')
createRule('no-nullish-coalescing', 'edge < 80, safari < 13.1, firefox < 72, chrome < 80', 'disallow the ?? nullish coalescing operator')
createRule('no-optional-chaining', 'edge < 80, safari < 13.1, firefox < 72, chrome < 80', 'disallow the .? optional chaning operator', {ts: 2020})
createRule('no-nullish-coalescing', 'edge < 80, safari < 13.1, firefox < 72, chrome < 80', 'disallow the ?? nullish coalescing operator', {ts: 2020})
createRule('no-bigint', 'edge < 79, safari < 14, firefox < 68, chrome < 67', 'disallow bigints')
// ES2021
createRule('no-numeric-separators', 'edge < 79, safari < 13, firefox < 68, chrome < 75', 'disallow use of numeric seperators like 1_000_000', {fixable: true})
createRule('no-numeric-separators', 'edge < 79, safari < 13, firefox < 68, chrome < 75', 'disallow use of numeric seperators like 1_000_000', {fixable: true, ts:2021})
// ES2022
createRule('no-public-static-class-fields', 'edge < 79, safari < 14.5, firefox < 75, chrome < 72', 'disallow public static class fields like foo = 1')
createRule('no-public-instance-class-fields', 'edge < 79, safari < 14.5, firefox < 69, chrome < 72', 'disallow public class fields like foo = 1')
createRule('no-computed-public-class-fields', 'edge < 79, safari < 14.5, firefox < 69, chrome < 74', 'disallow computed public static or instance class fields like [foo] = 1')
createRule('no-private-class-fields', 'edge < 79, safari < 14.5, firefox < 90, chrome < 74', 'disallow private class fields like #foo = 1')
createRule('no-public-static-class-fields', 'edge < 79, safari < 14.5, firefox < 75, chrome < 72', 'disallow public static class fields like foo = 1', {ts: 2022})
createRule('no-public-instance-class-fields', 'edge < 79, safari < 14.5, firefox < 69, chrome < 72', 'disallow public class fields like foo = 1', {ts: 2022})
createRule('no-computed-public-class-fields', 'edge < 79, safari < 14.5, firefox < 69, chrome < 74', 'disallow computed public static or instance class fields like [foo] = 1', {ts: 2022})
createRule('no-private-class-fields', 'edge < 79, safari < 14.5, firefox < 90, chrome < 74', 'disallow private class fields like #foo = 1', {ts: 2022})

@@ -80,20 +91,8 @@ // Proposals...

const allowedTypeScriptRules = new Set([
'no-exponentiation-operator',
'no-async-iteration',
'no-async-generator',
'no-object-rest-spread',
'no-optional-catch',
'no-optional-chaining',
'no-nullish-coalescing',
'no-numeric-separators',
'no-public-static-class-fields',
'no-public-instance-class-fields',
'no-private-class-fields',
])
module.exports.configs.typescript = {
plugins: ['escompat'],
parserOptions: { ecmaVersion: 2020 },
rules: Object.keys(module.exports.rules).filter(rule => !allowedTypeScriptRules.has(rule)).reduce((o, r) => (o['escompat/' + r] = ['error'], o), {})
extends: ['escompat:typescript-2016']
}
if (require.main === module) {
console.log(require('util').inspect(module.exports, {depth: Infinity}))
}
{
"name": "eslint-plugin-escompat",
"version": "3.2.0",
"version": "3.3.0",
"description": "",

@@ -5,0 +5,0 @@ "keywords": [],

@@ -27,3 +27,3 @@ # eslint-plugin-escompat

Aside from the `recommended` config, there is also the `typescript` config which can be used if you're using TypeScript. The TypeScript config only enables some of the rules, avoiding enabling rules for which `typescript` safely transpiles down to a more compatible syntax. To enable the `typescript` config, simply add the following to your eslint config:
Aside from the `recommended` config, there are also multiple `typescript` configs which can be used if you're using TypeScript. The TypeScript configs only enable some of the rules, avoiding enabling rules for which `typescript` safely transpiles down to a more compatible syntax. Extend the typescript config that matches your `tsconfig.json` `target` value.

@@ -33,3 +33,3 @@ ```js

{
"extends": ["plugin:escompat/typescript"]
"extends": ["plugin:escompat/typescript-2016"]
}

@@ -71,29 +71,24 @@ ```

- [no-async-generator](./docs/no-async-generator.md) ✔️
- [no-async-iteration](./docs/no-async-iteration.md) ✔️
- [no-bigint](./docs/no-bigint.md) ✔️ 🔹
- [no-bind-operator](./docs/no-bind-operator.md) ✔️ 🔹
- [no-computed-class-fields](./docs/no-computed-class-fields.md) ✔️ 🔹
- [no-do-expression](./docs/no-do-expression.md) ✔️ 🔹
- [no-dynamic-import](./docs/no-dynamic-import.md) ✔️ 🔹
- [no-edge-destructure-bug](./docs/no-edge-destructure-bug.md) ✔️ 🔹
- [no-exponentiation-operator](./docs/no-exponentiation-operator.md) ✔️
- [no-nullish-coalescing](./docs/no-nullish-coalescing.md) ✔️
- [no-numeric-separators](./docs/no-numeric-separators.md) ✔️
- [no-object-rest-spread](./docs/no-object-rest-spread.md) ✔️
- [no-optional-catch](./docs/no-optional-catch.md) ✔️
- [no-optional-chaining](./docs/no-optional-chaining.md) ✔️
- [no-pipeline-operator](./docs/no-pipeline-operator.md) ✔️ 🔹
- [no-private-class-fields](./docs/no-private-class-fields.md) ✔️
- [no-public-instance-class-fields](./docs/no-public-instance-class-fields.md) ✔️
- [no-public-static-class-fields](./docs/no-public-static-class-fields.md) ✔️
- [no-regexp-lookbehind](./docs/no-regexp-lookbehind.md) ✔️ 🔹
- [no-regexp-named-groups](./docs/no-regexp-named-groups.md) ✔️ 🔹
- [no-regexp-s-flag](./docs/no-regexp-s-flag.md) ✔️ 🔹
- [no-async-generator](./docs/no-async-generator.md)
- [no-async-iteration](./docs/no-async-iteration.md)
- [no-bigint](./docs/no-bigint.md)
- [no-bind-operator](./docs/no-bind-operator.md)
- [no-computed-class-fields](./docs/no-computed-class-fields.md)
- [no-do-expression](./docs/no-do-expression.md)
- [no-dynamic-import](./docs/no-dynamic-import.md)
- [no-edge-destructure-bug](./docs/no-edge-destructure-bug.md)
- [no-exponentiation-operator](./docs/no-exponentiation-operator.md)
- [no-nullish-coalescing](./docs/no-nullish-coalescing.md)
- [no-numeric-separators](./docs/no-numeric-separators.md)
- [no-object-rest-spread](./docs/no-object-rest-spread.md)
- [no-optional-catch](./docs/no-optional-catch.md)
- [no-optional-chaining](./docs/no-optional-chaining.md)
- [no-pipeline-operator](./docs/no-pipeline-operator.md)
- [no-private-class-fields](./docs/no-private-class-fields.md)
- [no-public-instance-class-fields](./docs/no-public-instance-class-fields.md)
- [no-public-static-class-fields](./docs/no-public-static-class-fields.md)
- [no-regexp-lookbehind](./docs/no-regexp-lookbehind.md)
- [no-regexp-named-groups](./docs/no-regexp-named-groups.md)
- [no-regexp-s-flag](./docs/no-regexp-s-flag.md)
#### Key:
✔️ = enabled in `plugin:escompat/recommended` config.
🔹 = enabled in `plugin:escompat/typescript` config.
## Inspiration

@@ -100,0 +95,0 @@ This project was largely inspired by the great [eslint-plugin-compat][epc] library.

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