Update checked-in dependencies

This commit is contained in:
github-actions[bot] 2024-09-23 17:29:51 +00:00
parent 65e62c7ee1
commit 7a2719db05
123 changed files with 2903 additions and 1746 deletions

120
node_modules/.package-lock.json generated vendored
View file

@ -455,9 +455,9 @@
}
},
"node_modules/@eslint/js": {
"version": "9.10.0",
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.10.0.tgz",
"integrity": "sha512-fuXtbiP5GWIn8Fz+LWoOMVf/Jxm+aajZYkhi6CuEm4SxymFM+eUWzbO9qXT+L0iCkL5+KGYMCSGxo686H19S1g==",
"version": "9.11.0",
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.11.0.tgz",
"integrity": "sha512-LPkkenkDqyzTFauZLLAPhIb48fj6drrfMvRGSL9tS3AcZBSVTllemLSNyCvHNNL2t797S/6DJNSIwRwXgMO/eQ==",
"dev": true,
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@ -803,6 +803,12 @@
"dev": true,
"license": "0BSD"
},
"node_modules/@rtsao/scc": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@rtsao/scc/-/scc-1.1.0.tgz",
"integrity": "sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g==",
"dev": true
},
"node_modules/@schemastore/package": {
"version": "0.0.10",
"license": "MIT"
@ -949,16 +955,16 @@
"license": "MIT"
},
"node_modules/@typescript-eslint/eslint-plugin": {
"version": "8.6.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.6.0.tgz",
"integrity": "sha512-UOaz/wFowmoh2G6Mr9gw60B1mm0MzUtm6Ic8G2yM1Le6gyj5Loi/N+O5mocugRGY+8OeeKmkMmbxNqUCq3B4Sg==",
"version": "8.7.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.7.0.tgz",
"integrity": "sha512-RIHOoznhA3CCfSTFiB6kBGLQtB/sox+pJ6jeFu6FxJvqL8qRxq/FfGO/UhsGgQM9oGdXkV4xUgli+dt26biB6A==",
"dev": true,
"dependencies": {
"@eslint-community/regexpp": "^4.10.0",
"@typescript-eslint/scope-manager": "8.6.0",
"@typescript-eslint/type-utils": "8.6.0",
"@typescript-eslint/utils": "8.6.0",
"@typescript-eslint/visitor-keys": "8.6.0",
"@typescript-eslint/scope-manager": "8.7.0",
"@typescript-eslint/type-utils": "8.7.0",
"@typescript-eslint/utils": "8.7.0",
"@typescript-eslint/visitor-keys": "8.7.0",
"graphemer": "^1.4.0",
"ignore": "^5.3.1",
"natural-compare": "^1.4.0",
@ -982,15 +988,15 @@
}
},
"node_modules/@typescript-eslint/parser": {
"version": "8.6.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.6.0.tgz",
"integrity": "sha512-eQcbCuA2Vmw45iGfcyG4y6rS7BhWfz9MQuk409WD47qMM+bKCGQWXxvoOs1DUp+T7UBMTtRTVT+kXr7Sh4O9Ow==",
"version": "8.7.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.7.0.tgz",
"integrity": "sha512-lN0btVpj2unxHlNYLI//BQ7nzbMJYBVQX5+pbNXvGYazdlgYonMn4AhhHifQ+J4fGRYA/m1DjaQjx+fDetqBOQ==",
"dev": true,
"dependencies": {
"@typescript-eslint/scope-manager": "8.6.0",
"@typescript-eslint/types": "8.6.0",
"@typescript-eslint/typescript-estree": "8.6.0",
"@typescript-eslint/visitor-keys": "8.6.0",
"@typescript-eslint/scope-manager": "8.7.0",
"@typescript-eslint/types": "8.7.0",
"@typescript-eslint/typescript-estree": "8.7.0",
"@typescript-eslint/visitor-keys": "8.7.0",
"debug": "^4.3.4"
},
"engines": {
@ -1010,13 +1016,13 @@
}
},
"node_modules/@typescript-eslint/scope-manager": {
"version": "8.6.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.6.0.tgz",
"integrity": "sha512-ZuoutoS5y9UOxKvpc/GkvF4cuEmpokda4wRg64JEia27wX+PysIE9q+lzDtlHHgblwUWwo5/Qn+/WyTUvDwBHw==",
"version": "8.7.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.7.0.tgz",
"integrity": "sha512-87rC0k3ZlDOuz82zzXRtQ7Akv3GKhHs0ti4YcbAJtaomllXoSO8hi7Ix3ccEvCd824dy9aIX+j3d2UMAfCtVpg==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "8.6.0",
"@typescript-eslint/visitor-keys": "8.6.0"
"@typescript-eslint/types": "8.7.0",
"@typescript-eslint/visitor-keys": "8.7.0"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@ -1027,13 +1033,13 @@
}
},
"node_modules/@typescript-eslint/type-utils": {
"version": "8.6.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.6.0.tgz",
"integrity": "sha512-dtePl4gsuenXVwC7dVNlb4mGDcKjDT/Ropsk4za/ouMBPplCLyznIaR+W65mvCvsyS97dymoBRrioEXI7k0XIg==",
"version": "8.7.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.7.0.tgz",
"integrity": "sha512-tl0N0Mj3hMSkEYhLkjREp54OSb/FI6qyCzfiiclvJvOqre6hsZTGSnHtmFLDU8TIM62G7ygEa1bI08lcuRwEnQ==",
"dev": true,
"dependencies": {
"@typescript-eslint/typescript-estree": "8.6.0",
"@typescript-eslint/utils": "8.6.0",
"@typescript-eslint/typescript-estree": "8.7.0",
"@typescript-eslint/utils": "8.7.0",
"debug": "^4.3.4",
"ts-api-utils": "^1.3.0"
},
@ -1051,9 +1057,9 @@
}
},
"node_modules/@typescript-eslint/types": {
"version": "8.6.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.6.0.tgz",
"integrity": "sha512-rojqFZGd4MQxw33SrOy09qIDS8WEldM8JWtKQLAjf/X5mGSeEFh5ixQlxssMNyPslVIk9yzWqXCsV2eFhYrYUw==",
"version": "8.7.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.7.0.tgz",
"integrity": "sha512-LLt4BLHFwSfASHSF2K29SZ+ZCsbQOM+LuarPjRUuHm+Qd09hSe3GCeaQbcCr+Mik+0QFRmep/FyZBO6fJ64U3w==",
"dev": true,
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@ -1064,13 +1070,13 @@
}
},
"node_modules/@typescript-eslint/typescript-estree": {
"version": "8.6.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.6.0.tgz",
"integrity": "sha512-MOVAzsKJIPIlLK239l5s06YXjNqpKTVhBVDnqUumQJja5+Y94V3+4VUFRA0G60y2jNnTVwRCkhyGQpavfsbq/g==",
"version": "8.7.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.7.0.tgz",
"integrity": "sha512-MC8nmcGHsmfAKxwnluTQpNqceniT8SteVwd2voYlmiSWGOtjvGXdPl17dYu2797GVscK30Z04WRM28CrKS9WOg==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "8.6.0",
"@typescript-eslint/visitor-keys": "8.6.0",
"@typescript-eslint/types": "8.7.0",
"@typescript-eslint/visitor-keys": "8.7.0",
"debug": "^4.3.4",
"fast-glob": "^3.3.2",
"is-glob": "^4.0.3",
@ -1116,15 +1122,15 @@
}
},
"node_modules/@typescript-eslint/utils": {
"version": "8.6.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.6.0.tgz",
"integrity": "sha512-eNp9cWnYf36NaOVjkEUznf6fEgVy1TWpE0o52e4wtojjBx7D1UV2WAWGzR+8Y5lVFtpMLPwNbC67T83DWSph4A==",
"version": "8.7.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.7.0.tgz",
"integrity": "sha512-ZbdUdwsl2X/s3CiyAu3gOlfQzpbuG3nTWKPoIvAu1pu5r8viiJvv2NPN2AqArL35NCYtw/lrPPfM4gxrMLNLPw==",
"dev": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.4.0",
"@typescript-eslint/scope-manager": "8.6.0",
"@typescript-eslint/types": "8.6.0",
"@typescript-eslint/typescript-estree": "8.6.0"
"@typescript-eslint/scope-manager": "8.7.0",
"@typescript-eslint/types": "8.7.0",
"@typescript-eslint/typescript-estree": "8.7.0"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@ -1138,12 +1144,12 @@
}
},
"node_modules/@typescript-eslint/visitor-keys": {
"version": "8.6.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.6.0.tgz",
"integrity": "sha512-wapVFfZg9H0qOYh4grNVQiMklJGluQrOUiOhYRrQWhx7BY/+I1IYb8BczWNbbUpO+pqy0rDciv3lQH5E1bCLrg==",
"version": "8.7.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.7.0.tgz",
"integrity": "sha512-b1tx0orFCCh/THWPQa2ZwWzvOeyzzp36vkJYOpVg0u8UVOIsfVrnuC9FqAw9gRKn+rG2VmWQ/zDJZzkxUnj/XQ==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "8.6.0",
"@typescript-eslint/types": "8.7.0",
"eslint-visitor-keys": "^3.4.3"
},
"engines": {
@ -2766,27 +2772,27 @@
}
},
"node_modules/eslint-plugin-import": {
"version": "2.29.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.29.1.tgz",
"integrity": "sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==",
"version": "2.30.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.30.0.tgz",
"integrity": "sha512-/mHNE9jINJfiD2EKkg1BKyPyUk4zdnT54YgbOgfjSakWT5oyX/qQLVNTkehyfpcMxZXMy1zyonZ2v7hZTX43Yw==",
"dev": true,
"license": "MIT",
"dependencies": {
"array-includes": "^3.1.7",
"array.prototype.findlastindex": "^1.2.3",
"@rtsao/scc": "^1.1.0",
"array-includes": "^3.1.8",
"array.prototype.findlastindex": "^1.2.5",
"array.prototype.flat": "^1.3.2",
"array.prototype.flatmap": "^1.3.2",
"debug": "^3.2.7",
"doctrine": "^2.1.0",
"eslint-import-resolver-node": "^0.3.9",
"eslint-module-utils": "^2.8.0",
"hasown": "^2.0.0",
"is-core-module": "^2.13.1",
"eslint-module-utils": "^2.9.0",
"hasown": "^2.0.2",
"is-core-module": "^2.15.1",
"is-glob": "^4.0.3",
"minimatch": "^3.1.2",
"object.fromentries": "^2.0.7",
"object.groupby": "^1.0.1",
"object.values": "^1.1.7",
"object.fromentries": "^2.0.8",
"object.groupby": "^1.0.3",
"object.values": "^1.2.0",
"semver": "^6.3.1",
"tsconfig-paths": "^3.15.0"
},

View file

@ -1,6 +1,6 @@
{
"name": "@eslint/js",
"version": "9.10.0",
"version": "9.11.0",
"description": "ESLint JavaScript language implementation",
"main": "./src/index.js",
"scripts": {},

21
node_modules/@rtsao/scc/LICENSE generated vendored Normal file
View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019 Ryan Tsao
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

49
node_modules/@rtsao/scc/README.md generated vendored Normal file
View file

@ -0,0 +1,49 @@
# `@rtsao/scc`
Find strongly connected components of a directed graph using [Tarjan's algorithm](https://en.wikipedia.org/wiki/Tarjan%27s_strongly_connected_components_algorithm).
This algorithm efficiently yields both a topological order and list of any cycles.
## Installation
```
yarn add @rtsao/scc
```
```
npm install @rtsao/scc
```
## Usage
```js
const scc = require("@rtsao/scc");
const digraph = new Map([
["a", new Set(["c", "d"])],
["b", new Set(["a"])],
["c", new Set(["b"])],
["d", new Set(["e"])],
["e", new Set()]
]);
const components = scc(digraph);
// [ Set { 'e' }, Set { 'd' }, Set { 'b', 'c', 'a' } ]
```
#### Illustration of example input digraph
```
┌───┐ ┌───┐
│ d │ ◀── │ a │ ◀┐
└───┘ └───┘ │
│ │ │
▼ ▼ │
┌───┐ ┌───┐ │
│ e │ │ c │ │
└───┘ └───┘ │
│ │
▼ │
┌───┐ │
│ b │ ─┘
└───┘
```

1
node_modules/@rtsao/scc/index.d.ts generated vendored Normal file
View file

@ -0,0 +1 @@
export default function tarjan<T>(graph: Map<T, Set<T>>): Array<Set<T>>

51
node_modules/@rtsao/scc/index.js generated vendored Normal file
View file

@ -0,0 +1,51 @@
"use strict";
module.exports = tarjan;
// Adapted from https://en.wikipedia.org/wiki/Tarjan%27s_strongly_connected_components_algorithm#The_algorithm_in_pseudocode
function tarjan(graph) {
const indices = new Map();
const lowlinks = new Map();
const onStack = new Set();
const stack = [];
const scc = [];
let idx = 0;
function strongConnect(v) {
indices.set(v, idx);
lowlinks.set(v, idx);
idx++;
stack.push(v);
onStack.add(v);
const deps = graph.get(v);
for (const dep of deps) {
if (!indices.has(dep)) {
strongConnect(dep);
lowlinks.set(v, Math.min(lowlinks.get(v), lowlinks.get(dep)));
} else if (onStack.has(dep)) {
lowlinks.set(v, Math.min(lowlinks.get(v), indices.get(dep)));
}
}
if (lowlinks.get(v) === indices.get(v)) {
const vertices = new Set();
let w = null;
while (v !== w) {
w = stack.pop();
onStack.delete(w);
vertices.add(w);
}
scc.push(vertices);
}
}
for (const v of graph.keys()) {
if (!indices.has(v)) {
strongConnect(v);
}
}
return scc;
}

5
node_modules/@rtsao/scc/index.js.flow generated vendored Normal file
View file

@ -0,0 +1,5 @@
// @flow
declare function tarjan<T>(graph: Map<T, Set<T>>): Array<Set<T>>;
declare module.exports: typeof tarjan;

7
node_modules/@rtsao/scc/package.json generated vendored Normal file
View file

@ -0,0 +1,7 @@
{
"name": "@rtsao/scc",
"version": "1.1.0",
"repository": "rtsao/scc",
"main": "index.js",
"license": "MIT"
}

View file

@ -79,8 +79,7 @@ exports.default = (0, util_1.createRule)({
function excludeAssignedProperty(node) {
if ((0, util_1.isAssignee)(node)) {
const { excludeSet } = propertiesInfoStack[propertiesInfoStack.length - 1];
const name = (0, util_1.getStaticStringValue)(node.property) ??
context.sourceCode.getText(node.property);
const name = (0, util_1.getStaticMemberAccessValue)(node, context);
if (name) {
excludeSet.add(name);
}

File diff suppressed because one or more lines are too long

View file

@ -121,7 +121,7 @@ exports.default = (0, util_1.createRule)({
}
const hashIfNeeded = node.key.type === utils_1.AST_NODE_TYPES.PrivateIdentifier ? '#' : '';
const name = (0, util_1.getStaticMemberAccessValue)(node, context);
return !exceptMethods.has(hashIfNeeded + (name ?? ''));
return (typeof name !== 'string' || !exceptMethods.has(hashIfNeeded + name));
}
/**
* Checks if we are leaving a function that is a method, and reports if 'this' has not been used.

View file

@ -1 +1 @@
{"version":3,"file":"class-methods-use-this.js","sourceRoot":"","sources":["../../src/rules/class-methods-use-this.ts"],"names":[],"mappings":";;AACA,oDAA0D;AAE1D,kCAKiB;AAYjB,kBAAe,IAAA,iBAAU,EAAsB;IAC7C,IAAI,EA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;oBACjD,SAAS,EAAE,aAAa;oBACxB,IAAI,EAAE;wBACJ,IAAI,EAAE,IAAA,8BAAuB,EAAC,IAAI,CAAC;qBACpC;iBACF,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,OAAO;YACL,sDAAsD;YACtD,mBAAmB;gBACjB,WAAW,EAAE,CAAC;YAChB,CAAC;YACD,0BAA0B;gBACxB,UAAU,EAAE,CAAC;YACf,CAAC;YAED,kBAAkB,CAAC,IAAI;gBACrB,aAAa,CAAC,IAAI,CAAC,CAAC;YACtB,CAAC;YACD,yBAAyB,CAAC,IAAI;gBAC5B,YAAY,CAAC,IAAI,CAAC,CAAC;YACrB,CAAC;YACD,GAAG,CAAC,qBAAqB;gBACvB,CAAC,CAAC;oBACE,oDAAoD,CAClD,IAAsC;wBAEtC,aAAa,CAAC,IAAI,CAAC,CAAC;oBACtB,CAAC;oBACD,yDAAyD,CACvD,IAAsC;wBAEtC,YAAY,CAAC,IAAI,CAAC,CAAC;oBACrB,CAAC;iBACF;gBACH,CAAC,CAAC,EAAE,CAAC;YAEP;;eAEG;YACH,iCAAiC;gBAC/B,WAAW,EAAE,CAAC;YAChB,CAAC;YACD,yBAAyB;gBACvB,UAAU,EAAE,CAAC;YACf,CAAC;YAED;;;;;eAKG;YACH,WAAW;gBACT,WAAW,EAAE,CAAC;YAChB,CAAC;YACD,kBAAkB;gBAChB,UAAU,EAAE,CAAC;YACf,CAAC;YAED,uBAAuB;gBACrB,IAAI,KAAK,EAAE,CAAC;oBACV,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC;gBACxB,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
{"version":3,"file":"class-methods-use-this.js","sourceRoot":"","sources":["../../src/rules/class-methods-use-this.ts"],"names":[],"mappings":";;AACA,oDAA0D;AAE1D,kCAKiB;AAYjB,kBAAe,IAAA,iBAAU,EAAsB;IAC7C,IAAI,EAAE,wBAAwB;IAC9B,IAAI,EAAE;QAC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AAE,aAAa;oBACxB,IAAI,EAAE;wBACJ,IAAI,EAAE,IAAA,8BAAuB,EAAC,IAAI,CAAC;qBACpC;iBACF,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,OAAO;YACL,sDAAsD;YACtD,mBAAmB;gBACjB,WAAW,EAAE,CAAC;YAChB,CAAC;YACD,0BAA0B;gBACxB,UAAU,EAAE,CAAC;YACf,CAAC;YAED,kBAAkB,CAAC,IAAI;gBACrB,aAAa,CAAC,IAAI,CAAC,CAAC;YACtB,CAAC;YACD,yBAAyB,CAAC,IAAI;gBAC5B,YAAY,CAAC,IAAI,CAAC,CAAC;YACrB,CAAC;YACD,GAAG,CAAC,qBAAqB;gBACvB,CAAC,CAAC;oBACE,oDAAoD,CAClD,IAAsC;wBAEtC,aAAa,CAAC,IAAI,CAAC,CAAC;oBACtB,CAAC;oBACD,yDAAyD,CACvD,IAAsC;wBAEtC,YAAY,CAAC,IAAI,CAAC,CAAC;oBACrB,CAAC;iBACF;gBACH,CAAC,CAAC,EAAE,CAAC;YAEP;;eAEG;YACH,iCAAiC;gBAC/B,WAAW,EAAE,CAAC;YAChB,CAAC;YACD,yBAAyB;gBACvB,UAAU,EAAE,CAAC;YACf,CAAC;YAED;;;;;eAKG;YACH,WAAW;gBACT,WAAW,EAAE,CAAC;YAChB,CAAC;YACD,kBAAkB;gBAChB,UAAU,EAAE,CAAC;YACf,CAAC;YAED,uBAAuB;gBACrB,IAAI,KAAK,EAAE,CAAC;oBACV,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC;gBACxB,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}

View file

@ -1,7 +1,31 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("@typescript-eslint/utils");
const typescript_1 = require("typescript");
const tsutils = __importStar(require("ts-api-utils"));
const ts = __importStar(require("typescript"));
const util_1 = require("../util");
exports.default = (0, util_1.createRule)({
name: 'consistent-type-exports',
@ -38,27 +62,79 @@ exports.default = (0, util_1.createRule)({
create(context, [{ fixMixedExportsWithInlineTypeSpecifier }]) {
const sourceExportsMap = {};
const services = (0, util_1.getParserServices)(context);
const checker = services.program.getTypeChecker();
/**
* Helper for identifying if an export specifier resolves to a
* Helper for identifying if a symbol resolves to a
* JavaScript value or a TypeScript type.
*
* @returns True/false if is a type or not, or undefined if the specifier
* can't be resolved.
*/
function isSpecifierTypeBased(specifier) {
const checker = services.program.getTypeChecker();
const symbol = services.getSymbolAtLocation(specifier.exported);
function isSymbolTypeBased(symbol) {
if (!symbol) {
return undefined;
}
const aliasedSymbol = checker.getAliasedSymbol(symbol);
// eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison
if (aliasedSymbol.escapedName === 'unknown') {
const aliasedSymbol = tsutils.isSymbolFlagSet(symbol, ts.SymbolFlags.Alias)
? checker.getAliasedSymbol(symbol)
: symbol;
if (checker.isUnknownSymbol(aliasedSymbol)) {
return undefined;
}
return !(aliasedSymbol.flags & typescript_1.SymbolFlags.Value);
return !(aliasedSymbol.flags & ts.SymbolFlags.Value);
}
return {
ExportAllDeclaration(node) {
if (node.exportKind === 'type') {
return;
}
const sourceModule = ts.resolveModuleName(node.source.value, context.filename, services.program.getCompilerOptions(), ts.sys);
if (sourceModule.resolvedModule == null) {
return;
}
const sourceFile = services.program.getSourceFile(sourceModule.resolvedModule.resolvedFileName);
if (sourceFile == null) {
return;
}
const sourceFileSymbol = checker.getSymbolAtLocation(sourceFile);
if (sourceFileSymbol == null) {
return;
}
const sourceFileType = checker.getTypeOfSymbol(sourceFileSymbol);
// Module can explicitly export types or values, and it's not difficult
// to distinguish one from the other, since we can get the flags of
// the exported symbols or check if symbol export declaration has
// the "type" keyword in it.
//
// Things get a lot more complicated when we're dealing with
// export * from './module-with-type-only-exports'
// export type * from './module-with-type-and-value-exports'
//
// TS checker has an internal function getExportsOfModuleWorker that
// recursively visits all module exports, including "export *". It then
// puts type-only-star-exported symbols into the typeOnlyExportStarMap
// property of sourceFile's SymbolLinks. Since symbol links aren't
// exposed outside the checker, we cannot access it directly.
//
// Therefore, to filter out value properties, we use the following hack:
// checker.getPropertiesOfType returns all exports that were originally
// values, but checker.getPropertyOfType returns undefined for
// properties that are mentioned in the typeOnlyExportStarMap.
const isThereAnyExportedValue = checker
.getPropertiesOfType(sourceFileType)
.some(propertyTypeSymbol => checker.getPropertyOfType(sourceFileType, propertyTypeSymbol.escapedName.toString()) != null);
if (isThereAnyExportedValue) {
return;
}
context.report({
node,
messageId: 'typeOverValue',
fix(fixer) {
const asteriskToken = (0, util_1.nullThrows)(context.sourceCode.getFirstToken(node, token => token.type === utils_1.AST_TOKEN_TYPES.Punctuator &&
token.value === '*'), util_1.NullThrowsReasons.MissingToken('asterisk', 'export all declaration'));
return fixer.insertTextBefore(asteriskToken, 'type ');
},
});
},
ExportNamedDeclaration(node) {
// Coerce the source into a string for use as a lookup entry.
const source = getSourceFromExport(node) ?? 'undefined';
@ -93,7 +169,7 @@ exports.default = (0, util_1.createRule)({
inlineTypeSpecifiers.push(specifier);
continue;
}
const isTypeBased = isSpecifierTypeBased(specifier);
const isTypeBased = isSymbolTypeBased(services.getSymbolAtLocation(specifier.exported));
if (isTypeBased === true) {
typeBasedSpecifiers.push(specifier);
}

File diff suppressed because one or more lines are too long

View file

@ -2,6 +2,16 @@
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("@typescript-eslint/utils");
const util_1 = require("../util");
const confusingOperators = new Set([
'=',
'==',
'===',
'in',
'instanceof',
]);
function isConfusingOperator(operator) {
return confusingOperators.has(operator);
}
exports.default = (0, util_1.createRule)({
name: 'no-confusing-non-null-assertion',
meta: {
@ -12,57 +22,108 @@ exports.default = (0, util_1.createRule)({
},
hasSuggestions: true,
messages: {
confusingEqual: 'Confusing combinations of non-null assertion and equal test like "a! == b", which looks very similar to not equal "a !== b".',
confusingAssign: 'Confusing combinations of non-null assertion and equal test like "a! = b", which looks very similar to not equal "a != b".',
notNeedInEqualTest: 'Unnecessary non-null assertion (!) in equal test.',
notNeedInAssign: 'Unnecessary non-null assertion (!) in assignment left hand.',
wrapUpLeft: 'Wrap up left hand to avoid putting non-null assertion "!" and "=" together.',
confusingEqual: 'Confusing combination of non-null assertion and equality test like `a! == b`, which looks very similar to `a !== b`.',
confusingAssign: 'Confusing combination of non-null assertion and assignment like `a! = b`, which looks very similar to `a != b`.',
confusingOperator: 'Confusing combination of non-null assertion and `{{operator}}` operator like `a! {{operator}} b`, which might be misinterpreted as `!(a {{operator}} b)`.',
notNeedInEqualTest: 'Remove unnecessary non-null assertion (!) in equality test.',
notNeedInAssign: 'Remove unnecessary non-null assertion (!) in assignment left-hand side.',
notNeedInOperator: 'Remove possibly unnecessary non-null assertion (!) in the left operand of the `{{operator}}` operator.',
wrapUpLeft: 'Wrap the left-hand side in parentheses to avoid confusion with "{{operator}}" operator.',
},
schema: [],
},
defaultOptions: [],
create(context) {
function confusingOperatorToMessageData(operator) {
switch (operator) {
case '=':
return {
messageId: 'confusingAssign',
};
case '==':
case '===':
return {
messageId: 'confusingEqual',
};
case 'in':
case 'instanceof':
return {
messageId: 'confusingOperator',
data: { operator },
};
// istanbul ignore next
default:
operator;
throw new Error(`Unexpected operator ${operator}`);
}
}
return {
'BinaryExpression, AssignmentExpression'(node) {
function isLeftHandPrimaryExpression(node) {
return node.type === utils_1.AST_NODE_TYPES.TSNonNullExpression;
}
if (node.operator === '==' ||
node.operator === '===' ||
node.operator === '=') {
const isAssign = node.operator === '=';
const operator = node.operator;
if (isConfusingOperator(operator)) {
// Look for a non-null assertion as the last token on the left hand side.
// That way, we catch things like `1 + two! === 3`, even though the left
// hand side isn't a non-null assertion AST node.
const leftHandFinalToken = context.sourceCode.getLastToken(node.left);
const tokenAfterLeft = context.sourceCode.getTokenAfter(node.left);
if (leftHandFinalToken?.type === utils_1.AST_TOKEN_TYPES.Punctuator &&
leftHandFinalToken.value === '!' &&
tokenAfterLeft?.value !== ')') {
if (isLeftHandPrimaryExpression(node.left)) {
if (node.left.type === utils_1.AST_NODE_TYPES.TSNonNullExpression) {
let suggestions;
switch (operator) {
case '=':
suggestions = [
{
messageId: 'notNeedInAssign',
fix: (fixer) => fixer.remove(leftHandFinalToken),
},
];
break;
case '==':
case '===':
suggestions = [
{
messageId: 'notNeedInEqualTest',
fix: (fixer) => fixer.remove(leftHandFinalToken),
},
];
break;
case 'in':
case 'instanceof':
suggestions = [
{
messageId: 'notNeedInOperator',
data: { operator },
fix: (fixer) => fixer.remove(leftHandFinalToken),
},
{
messageId: 'wrapUpLeft',
data: { operator },
fix: wrapUpLeftFixer(node),
},
];
break;
// istanbul ignore next
default:
operator;
return;
}
context.report({
node,
messageId: isAssign ? 'confusingAssign' : 'confusingEqual',
suggest: [
{
messageId: isAssign
? 'notNeedInAssign'
: 'notNeedInEqualTest',
fix: (fixer) => [
fixer.remove(leftHandFinalToken),
],
},
],
...confusingOperatorToMessageData(operator),
suggest: suggestions,
});
}
else {
context.report({
node,
messageId: isAssign ? 'confusingAssign' : 'confusingEqual',
...confusingOperatorToMessageData(operator),
suggest: [
{
messageId: 'wrapUpLeft',
fix: (fixer) => [
fixer.insertTextBefore(node.left, '('),
fixer.insertTextAfter(node.left, ')'),
],
data: { operator },
fix: wrapUpLeftFixer(node),
},
],
});
@ -73,4 +134,10 @@ exports.default = (0, util_1.createRule)({
};
},
});
function wrapUpLeftFixer(node) {
return (fixer) => [
fixer.insertTextBefore(node.left, '('),
fixer.insertTextAfter(node.left, ')'),
];
}
//# sourceMappingURL=no-confusing-non-null-assertion.js.map

View file

@ -1 +1 @@
{"version":3,"file":"no-confusing-non-null-assertion.js","sourceRoot":"","sources":["../../src/rules/no-confusing-non-null-assertion.ts"],"names":[],"mappings":";;AACA,oDAA2E;AAE3E,kCAAqC;AAErC,kBAAe,IAAA,iBAAU,EAAC;IACxB,IAAI,EAAE,iCAAiC;IACvC,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EACT,gEAAgE;YAClE,WAAW,EAAE,WAAW;SACzB;QACD,cAAc,EAAE,IAAI;QACpB,QAAQ,EAAE;YACR,cAAc,EACZ,8HAA8H;YAChI,eAAe,EACb,4HAA4H;YAC9H,kBAAkB,EAAE,mDAAmD;YACvE,eAAe,EACb,6DAA6D;YAC/D,UAAU,EACR,6EAA6E;SAChF;QACD,MAAM,EAAE,EAAE;KACX;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,wCAAwC,CACtC,IAA+D;gBAE/D,SAAS,2BAA2B,CAClC,IAAsD;oBAEtD,OAAO,IAAI,CAAC,IAAI,KAAK,sBAAc,CAAC,mBAAmB,CAAC;gBAC1D,CAAC;gBAED,IACE,IAAI,CAAC,QAAQ,KAAK,IAAI;oBACtB,IAAI,CAAC,QAAQ,KAAK,KAAK;oBACvB,IAAI,CAAC,QAAQ,KAAK,GAAG,EACrB,CAAC;oBACD,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,KAAK,GAAG,CAAC;oBACvC,MAAM,kBAAkB,GAAG,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,CAAC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BAAmB;4CAC9B,IAAI,EAAE,EAAE,QAAQ,EAAE;4CAClB,GAAG,EAAE,CAAC,KAAK,EAAW,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,kBAAkB,CAAC;yCAC1D;wCACD;4CACE,SAAS,EAAE,YAAY;4CACvB,IAAI,EAAE,EAAE,QAAQ,EAAE;4CAClB,GAAG,EAAE,eAAe,CAAC,IAAI,CAAC;yCAC3B;qCACF,CAAC;oCACF,MAAM;gCAER,uBAAuB;gCACvB;oCACE,QAAwB,CAAC;oCACzB,OAAO;4BACX,CAAC;4BACD,OAAO,CAAC,MAAM,CAAC;gCACb,IAAI;gCACJ,GAAG,8BAA8B,CAAC,QAAQ,CAAC;gCAC3C,OAAO,EAAE,WAAW;6BACrB,CAAC,CAAC;wBACL,CAAC;6BAAM,CAAC;4BACN,OAAO,CAAC,MAAM,CAAC;gCACb,IAAI;gCACJ,GAAG,8BAA8B,CAAC,QAAQ,CAAC;gCAC3C,OAAO,EAAE;oCACP;wCACE,SAAS,EAAE,YAAY;wCACvB,IAAI,EAAE,EAAE,QAAQ,EAAE;wCAClB,GAAG,EAAE,eAAe,CAAC,IAAI,CAAC;qCAC3B;iCACF;6BACF,CAAC,CAAC;wBACL,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAEH,SAAS,eAAe,CACtB,IAA+D;IAE/D,OAAO,CAAC,KAAK,EAAsB,EAAE,CAAC;QACpC,KAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC;QACtC,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC;KACtC,CAAC;AACJ,CAAC"}

View file

@ -50,6 +50,37 @@ exports.default = (0, util_1.createRule)({
}
const services = (0, util_1.getParserServices)(context);
const checker = services.program.getTypeChecker();
// Deprecated jsdoc tags can be added on some symbol alias, e.g.
//
// export { /** @deprecated */ foo }
//
// When we import foo, its symbol is an alias of the exported foo (the one
// with the deprecated tag), which is itself an alias of the original foo.
// Therefore, we carefully go through the chain of aliases and check each
// immediate alias for deprecated tags
function searchForDeprecationInAliasesChain(symbol, checkDeprecationsOfAliasedSymbol) {
if (!symbol || !tsutils.isSymbolFlagSet(symbol, ts.SymbolFlags.Alias)) {
return checkDeprecationsOfAliasedSymbol
? getJsDocDeprecation(symbol)
: undefined;
}
const targetSymbol = checker.getAliasedSymbol(symbol);
while (tsutils.isSymbolFlagSet(symbol, ts.SymbolFlags.Alias)) {
const reason = getJsDocDeprecation(symbol);
if (reason !== undefined) {
return reason;
}
const immediateAliasedSymbol = symbol.getDeclarations() && checker.getImmediateAliasedSymbol(symbol);
if (!immediateAliasedSymbol) {
break;
}
symbol = immediateAliasedSymbol;
if (checkDeprecationsOfAliasedSymbol && symbol === targetSymbol) {
return getJsDocDeprecation(symbol);
}
}
return undefined;
}
function isDeclaration(node) {
const { parent } = node;
switch (parent.type) {
@ -149,48 +180,63 @@ exports.default = (0, util_1.createRule)({
function getCallLikeDeprecation(node) {
const tsNode = services.esTreeNodeToTSNodeMap.get(node.parent);
// If the node is a direct function call, we look for its signature.
const signature = checker.getResolvedSignature(tsNode);
const signature = (0, util_1.nullThrows)(checker.getResolvedSignature(tsNode), 'Expected call like node to have signature');
const symbol = services.getSymbolAtLocation(node);
if (signature) {
const signatureDeprecation = getJsDocDeprecation(signature);
if (signatureDeprecation !== undefined) {
return signatureDeprecation;
}
// Properties with function-like types have "deprecated" jsdoc
// on their symbols, not on their signatures:
//
// interface Props {
// /** @deprecated */
// property: () => 'foo'
// ^symbol^ ^signature^
// }
const symbolDeclarationKind = symbol?.declarations?.[0].kind;
if (symbolDeclarationKind !== ts.SyntaxKind.MethodDeclaration &&
symbolDeclarationKind !== ts.SyntaxKind.FunctionDeclaration &&
symbolDeclarationKind !== ts.SyntaxKind.MethodSignature) {
return getJsDocDeprecation(symbol);
}
const aliasedSymbol = symbol !== undefined &&
tsutils.isSymbolFlagSet(symbol, ts.SymbolFlags.Alias)
? checker.getAliasedSymbol(symbol)
: symbol;
const symbolDeclarationKind = aliasedSymbol?.declarations?.[0].kind;
// Properties with function-like types have "deprecated" jsdoc
// on their symbols, not on their signatures:
//
// interface Props {
// /** @deprecated */
// property: () => 'foo'
// ^symbol^ ^signature^
// }
if (symbolDeclarationKind !== ts.SyntaxKind.MethodDeclaration &&
symbolDeclarationKind !== ts.SyntaxKind.FunctionDeclaration &&
symbolDeclarationKind !== ts.SyntaxKind.MethodSignature) {
return (searchForDeprecationInAliasesChain(symbol, true) ??
getJsDocDeprecation(signature) ??
getJsDocDeprecation(aliasedSymbol));
}
// Or it could be a ClassDeclaration or a variable set to a ClassExpression.
const symbolAtLocation = symbol && checker.getTypeOfSymbolAtLocation(symbol, tsNode).getSymbol();
return symbolAtLocation &&
tsutils.isSymbolFlagSet(symbolAtLocation, ts.SymbolFlags.Class)
? getJsDocDeprecation(symbolAtLocation)
: undefined;
}
function getSymbol(node) {
if (node.parent.type === utils_1.AST_NODE_TYPES.Property) {
return services
.getTypeAtLocation(node.parent.parent)
.getProperty(node.name);
}
return services.getSymbolAtLocation(node);
return (searchForDeprecationInAliasesChain(symbol,
// Here we're working with a function declaration or method.
// Both can have 1 or more overloads, each overload creates one
// ts.Declaration which is placed in symbol.declarations.
//
// Imagine the following code:
//
// function foo(): void
// /** @deprecated Some Reason */
// function foo(arg: string): void
// function foo(arg?: string): void {}
//
// foo() // <- foo is our symbol
//
// If we call getJsDocDeprecation(checker.getAliasedSymbol(symbol)),
// we get 'Some Reason', but after all, we are calling foo with
// a signature that is not deprecated!
// It works this way because symbol.getJsDocTags returns tags from
// all symbol declarations combined into one array. And AFAIK there is
// no publicly exported TS function that can tell us if a particular
// declaration is deprecated or not.
//
// So, in case of function and method declarations, we don't check original
// aliased symbol, but rely on the getJsDocDeprecation(signature) call below.
false) ?? getJsDocDeprecation(signature));
}
function getDeprecationReason(node) {
const callLikeNode = getCallLikeNode(node);
return callLikeNode
? getCallLikeDeprecation(callLikeNode)
: getJsDocDeprecation(getSymbol(node));
if (callLikeNode) {
return getCallLikeDeprecation(callLikeNode);
}
if (node.parent.type === utils_1.AST_NODE_TYPES.Property) {
return getJsDocDeprecation(services.getTypeAtLocation(node.parent.parent).getProperty(node.name));
}
return searchForDeprecationInAliasesChain(services.getSymbolAtLocation(node), true);
}
function checkIdentifier(node) {
if (isDeclaration(node) || isInsideExportOrImport(node)) {

File diff suppressed because one or more lines are too long

View file

@ -35,13 +35,13 @@ exports.default = (0, util_1.createRule)({
requiresTypeChecking: true,
},
messages: {
unsafeCall: 'Unsafe call of an {{type}} typed value.',
unsafeCall: 'Unsafe call of a(n) {{type}} typed value.',
unsafeCallThis: [
'Unsafe call of an `any` typed value. `this` is typed as `any`.',
'Unsafe call of a(n) {{type}} typed value. `this` is typed as {{type}}.',
'You can try to fix this by turning on the `noImplicitThis` compiler option, or adding a `this` parameter to the function.',
].join('\n'),
unsafeNew: 'Unsafe construction of an any type value.',
unsafeTemplateTag: 'Unsafe any typed template tag.',
unsafeNew: 'Unsafe construction of a(n) {{type}} typed value.',
unsafeTemplateTag: 'Unsafe use of a(n) {{type}} typed template tag.',
},
schema: [],
},
@ -69,6 +69,41 @@ exports.default = (0, util_1.createRule)({
type: isErrorType ? '`error` type' : '`any`',
},
});
return;
}
if ((0, util_1.isBuiltinSymbolLike)(services.program, type, 'Function')) {
// this also matches subtypes of `Function`, like `interface Foo extends Function {}`.
//
// For weird TS reasons that I don't understand, these are
//
// safe to construct if:
// - they have at least one call signature _that is not void-returning_,
// - OR they have at least one construct signature.
//
// safe to call (including as template) if:
// - they have at least one call signature
// - OR they have at least one construct signature.
const constructSignatures = type.getConstructSignatures();
if (constructSignatures.length > 0) {
return;
}
const callSignatures = type.getCallSignatures();
if (messageId === 'unsafeNew') {
if (callSignatures.some(signature => !tsutils.isIntrinsicVoidType(signature.getReturnType()))) {
return;
}
}
else if (callSignatures.length > 0) {
return;
}
context.report({
node: reportingNode,
messageId,
data: {
type: '`Function`',
},
});
return;
}
}
return {

View file

@ -1 +1 @@
{"version":3,"file":"no-unsafe-call.js","sourceRoot":"","sources":["../../src/rules/no-unsafe-call.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,sDAAwC;AAExC,kCAMiB;AAQjB,kBAAe,IAAA,iBAAU,EAAiB;IACxC,IAAI,EAAE,gBAAgB;IACtB,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EAAE,0CAA0C;YACvD,WAAW,EAAE,aAAa;YAC1B,oBAAoB,EAAE,IAAI;SAC3B;QACD,QAAQ,EAAE;YACR,UAAU,EAAE,yCAAyC;YACrD,cAAc,EAAE;gBACd,gEAAgE;gBAChE,2HAA2H;aAC5H,CAAC,IAAI,CAAC,IAAI,CAAC;YACZ,SAAS,EAAE,2CAA2C;YACtD,iBAAiB,EAAE,gCAAgC;SACpD;QACD,MAAM,EAAE,EAAE;KACX;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,CAAC,OAAO;QACZ,MAAM,QAAQ,GAAG,IAAA,wBAAiB,EAAC,OAAO,CAAC,CAAC;QAC5C,MAAM,eAAe,GAAG,QAAQ,CAAC,OAAO,CAAC,kBAAkB,EAAE,CAAC;QAC9D,MAAM,gBAAgB,GAAG,OAAO,CAAC,6BAA6B,CAC5D,eAAe,EACf,gBAAgB,CACjB,CAAC;QAEF,SAAS,SAAS,CAChB,IAAmB,EACnB,aAA4B,EAC5B,SAAqB;YAErB,MAAM,IAAI,GAAG,IAAA,mCAA4B,EAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;YAE1D,IAAI,IAAA,oBAAa,EAAC,IAAI,CAAC,EAAE,CAAC;gBACxB,IAAI,CAAC,gBAAgB,EAAE,CAAC;oBACtB,gDAAgD;oBAChD,MAAM,cAAc,GAAG,IAAA,wBAAiB,EAAC,IAAI,CAAC,CAAC;oBAC/C,IACE,cAAc;wBACd,IAAA,oBAAa,EACX,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require("./needsPrecedingSemiColon"), exports);
__exportStar(require("./objectIterators"), exports);
__exportStar(require("./scopeUtils"), exports);
__exportStar(require("./types"), exports);
__exportStar(require("./isAssignee"), exports);
__exportStar(require("./getFixOrSuggest"), exports);
__exportStar(require("./isArrayMethodCallWithPredicate"), exports);

View file

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,oDAAuD;AAEvD,6CAA2B;AAC3B,2DAAyC;AACzC,+CAA6B;AAC7B,uDAAqC;AACrC,0DAAwC;AACxC,yDAAuC;AACvC,oDAAkC;AAClC,2DAAyC;AACzC,sDAAoC;AACpC,qDAAmC;AACnC,gDAA8B;AAC9B,kDAAgC;AAChC,iEAA+C;AAC/C,0DAAwC;AACxC,yCAAuB;AACvB,4DAA0C;AAC1C,oDAAkC;AAClC,+CAA6B;AAC7B,0CAAwB;AACxB,+CAA6B;AAC7B,oDAAkC;AAClC,mEAAiD;AAEjD,sEAAsE;AACtE,gEAA8C;AAC9C,MAAM,EACJ,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,iBAAiB,GAClB,GAAG,mBAAW,CAAC;AAMd,oCAAY;AACZ,8BAAS;AACT,4CAAgB;AAChB,8CAAiB;AACjB,gCAAU;AAGV,8CAAiB"}
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,oDAAuD;AAEvD,6CAA2B;AAC3B,2DAAyC;AACzC,+CAA6B;AAC7B,uDAAqC;AACrC,0DAAwC;AACxC,yDAAuC;AACvC,oDAAkC;AAClC,2DAAyC;AACzC,sDAAoC;AACpC,qDAAmC;AACnC,gDAA8B;AAC9B,kDAAgC;AAChC,iEAA+C;AAC/C,0DAAwC;AACxC,yCAAuB;AACvB,4DAA0C;AAC1C,oDAAkC;AAClC,+CAA6B;AAE7B,+CAA6B;AAC7B,oDAAkC;AAClC,mEAAiD;AAEjD,sEAAsE;AACtE,gEAA8C;AAC9C,MAAM,EACJ,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,iBAAiB,GAClB,GAAG,mBAAW,CAAC;AAMd,oCAAY;AACZ,8BAAS;AACT,4CAAgB;AAChB,8CAAiB;AACjB,gCAAU;AAGV,8CAAiB"}

View file

@ -42,7 +42,7 @@ function isArrayMethodCallWithPredicate(context, services, node) {
return false;
}
const staticAccessValue = (0, misc_1.getStaticMemberAccessValue)(node.callee, context);
if (!staticAccessValue || !ARRAY_PREDICATE_FUNCTIONS.has(staticAccessValue)) {
if (!ARRAY_PREDICATE_FUNCTIONS.has(staticAccessValue)) {
return false;
}
const checker = services.program.getTypeChecker();

View file

@ -1 +1 @@
{"version":3,"file":"isArrayMethodCallWithPredicate.js","sourceRoot":"","sources":["../../src/util/isArrayMethodCallWithPredicate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,wEAqBC;AA1CD,8DAA6E;AAK7E,oDAA0D;AAE1D,sDAAwC;AAExC,iCAAoD;AAEpD,MAAM,yBAAyB,GAAG,IAAI,GAAG,CAAC;IACxC,QAAQ;IACR,MAAM;IACN,WAAW;IACX,UAAU;IACV,eAAe;IACf,MAAM;IACN,OAAO;CACR,CAAC,CAAC;AAEH,SAAgB,8BAA8B,CAC5C,OAAuC,EACvC,QAA2C,EAC3C,IAA6B;IAE7B,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,sBAAc,CAAC,gBAAgB,EAAE,CAAC;QACzD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,iBAAiB,GAAG,IAAA,iCAA0B,EAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAE3E,IAAI,CAAC,iBAAiB,IAAI,CAAC,yBAAyB,CAAC,GAAG,CAAC,iBAAiB,CAAC,EAAE,CAAC;QAC5E,OAAO,KAAK,CA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EAAE,CAAC;IAClD,MAAM,IAAI,GAAG,IAAA,yCAA4B,EAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACxE,OAAO,OAAO;SACX,cAAc,CAAC,IAAI,CAAC;SACpB,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;SACpD,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;AACjE,CAAC"}

View file

@ -196,20 +196,70 @@ function isRestParameterDeclaration(decl) {
function isParenlessArrowFunction(node, sourceCode) {
return (node.params.length === 1 && !(0, astUtils_1.isParenthesized)(node.params[0], sourceCode));
}
/**
* Gets a member being accessed or declared if its value can be determined statically, and
* resolves it to the string or symbol value that will be used as the actual member
* access key at runtime. Otherwise, returns `undefined`.
*
* ```ts
* x.member // returns 'member'
* ^^^^^^^^
*
* x?.member // returns 'member' (optional chaining is treated the same)
* ^^^^^^^^^
*
* x['value'] // returns 'value'
* ^^^^^^^^^^
*
* x[Math.random()] // returns undefined (not a static value)
* ^^^^^^^^^^^^^^^^
*
* arr[0] // returns '0' (NOT 0)
* ^^^^^^
*
* arr[0n] // returns '0' (NOT 0n)
* ^^^^^^^
*
* const s = Symbol.for('symbolName')
* x[s] // returns `Symbol.for('symbolName')` (since it's a static/global symbol)
* ^^^^
*
* const us = Symbol('symbolName')
* x[us] // returns undefined (since it's a unique symbol, so not statically analyzable)
* ^^^^^
*
* var object = {
* 1234: '4567', // returns '1234' (NOT 1234)
* ^^^^^^^^^^^^
* method() { } // returns 'method'
* ^^^^^^^^^^^^
* }
*
* class WithMembers {
* foo: string // returns 'foo'
* ^^^^^^^^^^^
* }
* ```
*/
function getStaticMemberAccessValue(node, { sourceCode }) {
const key = node.type === utils_1.AST_NODE_TYPES.MemberExpression ? node.property : node.key;
if (!node.computed) {
return key.type === utils_1.AST_NODE_TYPES.Literal
? `${key.value}`
: key.name;
const { type } = key;
if (!node.computed &&
(type === utils_1.AST_NODE_TYPES.Identifier ||
type === utils_1.AST_NODE_TYPES.PrivateIdentifier)) {
return key.name;
}
const value = (0, astUtils_1.getStaticValue)(key, sourceCode.getScope(node))?.value;
return value == null ? undefined : `${value}`;
const result = (0, astUtils_1.getStaticValue)(key, sourceCode.getScope(node));
if (!result) {
return undefined;
}
const { value } = result;
return typeof value === 'symbol' ? value : String(value);
}
/**
* Answers whether the member expression looks like
* `x.memberName`, `x['memberName']`,
* or even `const mn = 'memberName'; x[mn]` (or optional variants thereof).
* `x.value`, `x['value']`,
* or even `const v = 'value'; x[v]` (or optional variants thereof).
*/
const isStaticMemberAccessOfValue = (memberExpression, context, ...values) => values.includes(getStaticMemberAccessValue(memberExpression, context));
exports.isStaticMemberAccessOfValue = isStaticMemberAccessOfValue;

File diff suppressed because one or more lines are too long

View file

@ -9,14 +9,27 @@ import TabItem from '@theme/TabItem';
>
> See **https://typescript-eslint.io/rules/no-confusing-non-null-assertion** for documentation.
Using a non-null assertion (`!`) next to an assign or equals check (`=` or `==` or `===`) creates code that is confusing as it looks similar to a not equals check (`!=` `!==`).
Using a non-null assertion (`!`) next to an assignment or equality check (`=` or `==` or `===`) creates code that is confusing as it looks similar to an inequality check (`!=` `!==`).
```typescript
a! == b; // a non-null assertions(`!`) and an equals test(`==`)
a! == b; // a non-null assertion(`!`) and an equals test(`==`)
a !== b; // not equals test(`!==`)
a! === b; // a non-null assertions(`!`) and an triple equals test(`===`)
a! === b; // a non-null assertion(`!`) and a triple equals test(`===`)
```
Using a non-null assertion (`!`) next to an in test (`in`) or an instanceof test (`instanceof`) creates code that is confusing since it may look like the operator is negated, but it is actually not.
{/* prettier-ignore */}
```typescript
a! in b; // a non-null assertion(`!`) and an in test(`in`)
a !in b; // also a non-null assertion(`!`) and an in test(`in`)
!(a in b); // a negated in test
a! instanceof b; // a non-null assertion(`!`) and an instanceof test(`instanceof`)
a !instanceof b; // also a non-null assertion(`!`) and an instanceof test(`instanceof`)
!(a instanceof b); // a negated instanceof test
````
This rule flags confusing `!` assertions and suggests either removing them or wrapping the asserted expression in `()` parenthesis.
## Examples

View file

@ -12,14 +12,13 @@ import TabItem from '@theme/TabItem';
A "floating" Promise is one that is created without any code set up to handle any errors it might throw.
Floating Promises can cause several issues, such as improperly sequenced operations, ignored Promise rejections, and more.
This rule reports when a Promise is created and not properly handled.
Valid ways of handling a Promise-valued statement include:
This rule will report Promise-valued statements that are not treated in one of the following ways:
- `await`ing it
- `return`ing it
- `void`ing it
- Calling its `.then()` with two arguments
- Calling its `.catch()` with one argument
- `await`ing it
- `return`ing it
- [`void`ing it](#ignorevoid)
This rule also reports when an Array containing Promises is created and not properly handled. The main way to resolve this is by using one of the Promise concurrency methods to create a single Promise, then handling that according to the procedure above. These methods include:
@ -29,8 +28,10 @@ This rule also reports when an Array containing Promises is created and not prop
- `Promise.race()`
:::tip
`no-floating-promises` only detects unhandled Promise _statements_.
`no-floating-promises` only detects apparently unhandled Promise _statements_.
See [`no-misused-promises`](./no-misused-promises.mdx) for detecting code that provides Promises to _logical_ locations such as if statements.
See [_Using promises (error handling) on MDN_](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises#error_handling) for a detailed writeup on Promise error-handling.
:::
## Examples
@ -134,6 +135,12 @@ await createMyThenable();
This option, which is `true` by default, allows you to stop the rule reporting promises consumed with the [`void` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/void).
This can be a good way to explicitly mark a promise as intentionally not awaited.
:::warning
Voiding a Promise doesn't handle it or change the runtime behavior.
The outcome is just ignored, like disabling the rule with an [ESLint disable comment](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1).
Such Promise rejections will still be unhandled.
:::
Examples of **correct** code for this rule with `{ ignoreVoid: true }`:
```ts option='{ "ignoreVoid": true }' showPlaygroundButton

View file

@ -106,6 +106,8 @@ class Foo {
If you strongly prefer to have explicit types regardless of whether they can be inferred, this rule may not be for you.
If you use the `--isolatedDeclarations` compiler option, this rule is incompatible.
## Further Reading
- [TypeScript Inference](https://www.typescriptlang.org/docs/handbook/type-inference.html)

View file

@ -19,7 +19,7 @@ At best unnecessary type parameters make code harder to read.
At worst they can be used to disguise unsafe type assertions.
:::warning
This rule was recently added, and has a surprising amount of hidden complexity compared to most of our rules. If you encounter unexpected behavior with it, please check closely the [Limitations](#limitations) section below and our [issue tracker](https://github.com/typescript-eslint/typescript-eslint/issues?q=is%3Aissue+no-unnecessary-type-parameters).
This rule was recently added, and has a surprising amount of hidden complexity compared to most of our rules. If you encounter unexpected behavior with it, please check closely the [Limitations](#limitations) and [FAQ](#faq) sections below and our [issue tracker](https://github.com/typescript-eslint/typescript-eslint/issues?q=is%3Aissue+no-unnecessary-type-parameters).
If you don't see your case covered, please [reach out to us](https://typescript-eslint.io/contributing/issues)!
:::
@ -87,6 +87,127 @@ This is because the type parameter `T` relates multiple methods in the `T[]` tog
Therefore, this rule won't report on type parameters used as a type argument.
That includes type arguments given to global types such as `Array` (including the `T[]` shorthand and in tuples), `Map`, and `Set`.
## FAQ
### The return type is only used as an input, so why isn't the rule reporting?
One common reason that this might be the case is when the return type is not specified explicitly.
The rule uses uses type information to count implicit usages of the type parameter in the function signature, including in the inferred return type.
For example, the following function...
```ts
function identity<T>(arg: T) {
return arg;
}
```
...implicitly has a return type of `T`. Therefore, the type parameter `T` is used twice, and the rule will not report this function.
For other reasons the rule might not be reporting, be sure to check the [Limitations section](#limitations) and other FAQs.
### I'm using the type parameter inside the function, so why is the rule reporting?
You might be surprised to that the rule reports on a function like this:
```ts
function log<T extends string>(string1: T): void {
const string2: T = string1;
console.log(string2);
}
```
After all, the type parameter `T` relates the input `string1` and the local variable `string2`, right?
However, this usage is unnecessary, since we can achieve the same results by replacing all usages of the type parameter with its constraint.
That is to say, the function can always be rewritten as:
```ts
function log(string1: string): void {
const string2: string = string1;
console.log(string2);
}
```
Therefore, this rule only counts usages of a type parameter in the _signature_ of a function, method, or class, but not in the implementation. See also [#9735](https://github.com/typescript-eslint/typescript-eslint/issues/9735)
### Why am I getting TypeScript errors saying "Object literal may only specify known properties" after removing an unnecessary type parameter?
Suppose you have a situation like the following, which will trigger the rule to report.
```ts
interface SomeProperties {
foo: string;
}
// T is only used once, so the rule will report.
function serialize<T extends SomeProperties>(x: T): string {
return JSON.stringify(x);
}
serialize({ foo: 'bar', anotherProperty: 'baz' });
```
If we remove the unnecessary type parameter, we'll get an error:
```ts
function serialize(x: SomeProperties): string {
return JSON.stringify(x);
}
// TS Error: Object literal may only specify known properties, and 'anotherProperty' does not exist in type 'SomeProperties'.
serialize({ foo: 'bar', anotherProperty: 'baz' });
```
This is because TypeScript figures it's _usually_ an error to explicitly provide excess properties in a location that expects a specific type.
See [the TypeScript handbook's section on excess property checks](https://www.typescriptlang.org/docs/handbook/2/objects.html#excess-property-checks) for further discussion.
To resolve this, you have two approaches to choose from.
1. If it doesn't make sense to accept excess properties in your function, you'll want to fix the errors at the call sites. Usually, you can simply remove any excess properties where the function is called.
2. Otherwise, if you do want your function to accept excess properties, you can modify the parameter type in order to allow excess properties explicitly by using an [index signature](https://www.typescriptlang.org/docs/handbook/2/objects.html#index-signatures):
```ts
interface SomeProperties {
foo: string;
// This allows any other properties.
// You may wish to make these types more specific according to your use case.
[key: PropertKey]: unknown;
}
function serialize(x: SomeProperties): string {
return JSON.stringify(x);
}
// No error!
serialize({ foo: 'bar', anotherProperty: 'baz' });
```
Which solution is appropriate is a case-by-case decision, depending on the intended use case of your function.
### I have a complex scenario that is reported by the rule, but I can't see how to remove the type parameter. What should I do?
Sometimes, you may be able to rewrite the code by reaching for some niche TypeScript features, such as [the `NoInfer<T>` utility type](https://www.typescriptlang.org/docs/handbook/utility-types.html#noinfertype) (see [#9751](https://github.com/typescript-eslint/typescript-eslint/issues/9751)).
But, quite possibly, you've hit an edge case where the type is being used in a subtle way that the rule doesn't account for.
For example, the following arcane code is a way of testing whether two types are equal, and will be reported by the rule (see [#9709](https://github.com/typescript-eslint/typescript-eslint/issues/9709)):
{/* prettier-ignore */}
```ts
type Compute<A> = A extends Function ? A : { [K in keyof A]: Compute<A[K]> };
type Equal<X, Y> =
(<T1>() => T1 extends Compute<X> ? 1 : 2) extends
(<T2>() => T2 extends Compute<Y> ? 1 : 2)
? true
: false;
```
In this case, the function types created within the `Equal` type are never expected to be assigned to; they're just created for the purpose of type system manipulations.
This usage is not what the rule is intended to analyze.
Use eslint-disable comments as appropriate to suppress the rule in these kinds of cases.
{/* TODO - include an FAQ entry regarding instantiation expressions once the conversation in https://github.com/typescript-eslint/typescript-eslint/pull/9536#discussion_r1705850744 is done */}
## When Not To Use It
This rule will report on functions that use type parameters solely to test types, for example:

View file

@ -59,6 +59,34 @@ String.raw`foo`;
</TabItem>
</Tabs>
## The Unsafe `Function` Type
The `Function` type is behaves almost identically to `any` when called, so this rule also disallows calling values of type `Function`.
<Tabs>
<TabItem value="❌ Incorrect">
```ts
const f: Function = () => {};
f();
```
</TabItem>
</Tabs>
Note that whereas [no-unsafe-function-type](./no-unsafe-function-type.mdx) helps prevent the _creation_ of `Function` types, this rule helps prevent the unsafe _use_ of `Function` types, which may creep into your codebase without explicitly referencing the `Function` type at all.
See, for example, the following code:
```ts
function unsafe(maybeFunction: unknown): string {
if (typeof maybeFunction === 'function') {
// TypeScript allows this, but it's completely unsound.
return maybeFunction('call', 'with', 'any', 'args');
}
// etc
}
```
## When Not To Use It
If your codebase has many existing `any`s or areas of unsafe code, it may be difficult to enable this rule.

View file

@ -60,4 +60,5 @@ You might consider using [ESLint disable comments](https://eslint.org/docs/lates
- [`no-empty-object-type`](./no-empty-object-type.mdx)
- [`no-restricted-types`](./no-restricted-types.mdx)
- [`no-unsafe-call`](./no-unsafe-call.mdx)
- [`no-wrapper-object-types`](./no-wrapper-object-types.mdx)

View file

@ -146,9 +146,11 @@ Set this to `true` at your own risk.
:::danger Deprecated
> This option will be removed in the next major version of typescript-eslint.
> :::
> If this is set to `false`, then the rule will error on every file whose `tsconfig.json` does _not_ have the `strictNullChecks` compiler option (or `strict`) set to `true`.
This option will be removed in the next major version of typescript-eslint.
:::
If this is set to `false`, then the rule will error on every file whose `tsconfig.json` does _not_ have the `strictNullChecks` compiler option (or `strict`) set to `true`.
Without `strictNullChecks`, TypeScript essentially erases `undefined` and `null` from the types. This means when this rule inspects the types from a variable, **it will not be able to tell that the variable might be `null` or `undefined`**, which essentially makes this rule a lot less useful.

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/eslint-plugin",
"version": "8.6.0",
"version": "8.7.0",
"description": "TypeScript plugin for ESLint",
"files": [
"dist",
@ -60,10 +60,10 @@
},
"dependencies": {
"@eslint-community/regexpp": "^4.10.0",
"@typescript-eslint/scope-manager": "8.6.0",
"@typescript-eslint/type-utils": "8.6.0",
"@typescript-eslint/utils": "8.6.0",
"@typescript-eslint/visitor-keys": "8.6.0",
"@typescript-eslint/scope-manager": "8.7.0",
"@typescript-eslint/type-utils": "8.7.0",
"@typescript-eslint/utils": "8.7.0",
"@typescript-eslint/visitor-keys": "8.7.0",
"graphemer": "^1.4.0",
"ignore": "^5.3.1",
"natural-compare": "^1.4.0",
@ -74,8 +74,8 @@
"@types/marked": "^5.0.2",
"@types/mdast": "^4.0.3",
"@types/natural-compare": "*",
"@typescript-eslint/rule-schema-to-typescript-types": "8.6.0",
"@typescript-eslint/rule-tester": "8.6.0",
"@typescript-eslint/rule-schema-to-typescript-types": "8.7.0",
"@typescript-eslint/rule-tester": "8.7.0",
"ajv": "^6.12.6",
"cross-env": "^7.0.3",
"cross-fetch": "*",

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/parser",
"version": "8.6.0",
"version": "8.7.0",
"description": "An ESLint custom parser which leverages TypeScript ESTree",
"files": [
"dist",
@ -52,10 +52,10 @@
"eslint": "^8.57.0 || ^9.0.0"
},
"dependencies": {
"@typescript-eslint/scope-manager": "8.6.0",
"@typescript-eslint/types": "8.6.0",
"@typescript-eslint/typescript-estree": "8.6.0",
"@typescript-eslint/visitor-keys": "8.6.0",
"@typescript-eslint/scope-manager": "8.7.0",
"@typescript-eslint/types": "8.7.0",
"@typescript-eslint/typescript-estree": "8.7.0",
"@typescript-eslint/visitor-keys": "8.7.0",
"debug": "^4.3.4"
},
"devDependencies": {

View file

@ -1,6 +1,6 @@
export * from './CatchClauseDefinition';
export * from './ClassNameDefinition';
export * from './Definition';
export type * from './Definition';
export * from './DefinitionType';
export * from './FunctionNameDefinition';
export * from './ImplicitGlobalVariableDefinition';

View file

@ -1 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/definition/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oCAAoC,CAAC;AACnD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC"}
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/definition/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,mBAAmB,cAAc,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oCAAoC,CAAC;AACnD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC"}

View file

@ -16,7 +16,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./CatchClauseDefinition"), exports);
__exportStar(require("./ClassNameDefinition"), exports);
__exportStar(require("./Definition"), exports);
__exportStar(require("./DefinitionType"), exports);
__exportStar(require("./FunctionNameDefinition"), exports);
__exportStar(require("./ImplicitGlobalVariableDefinition"), exports);

View file

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/definition/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC;AACxC,wDAAsC;AACtC,+CAA6B;AAC7B,mDAAiC;AACjC,2DAAyC;AACzC,qEAAmD;AACnD,4DAA0C;AAC1C,wDAAsC;AACtC,2DAAyC;AACzC,yDAAuC;AACvC,2DAAyC;AACzC,mDAAiC;AACjC,uDAAqC"}
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/definition/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC;AACxC,wDAAsC;AAEtC,mDAAiC;AACjC,2DAAyC;AACzC,qEAAmD;AACnD,4DAA0C;AAC1C,wDAAsC;AACtC,2DAAyC;AACzC,yDAAuC;AACvC,2DAAyC;AACzC,mDAAiC;AACjC,uDAAqC"}

View file

@ -10,7 +10,7 @@ export * from './FunctionTypeScope';
export * from './GlobalScope';
export * from './MappedTypeScope';
export * from './ModuleScope';
export * from './Scope';
export type * from './Scope';
export * from './ScopeType';
export * from './SwitchScope';
export * from './TSEnumScope';

View file

@ -1 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/scope/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,YAAY,CAAC;AAC3B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC"}
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/scope/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,YAAY,CAAC;AAC3B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,mBAAmB,SAAS,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC"}

View file

@ -26,7 +26,6 @@ __exportStar(require("./FunctionTypeScope"), exports);
__exportStar(require("./GlobalScope"), exports);
__exportStar(require("./MappedTypeScope"), exports);
__exportStar(require("./ModuleScope"), exports);
__exportStar(require("./Scope"), exports);
__exportStar(require("./ScopeType"), exports);
__exportStar(require("./SwitchScope"), exports);
__exportStar(require("./TSEnumScope"), exports);

View file

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/scope/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,+CAA6B;AAC7B,+DAA6C;AAC7C,+CAA6B;AAC7B,yDAAuC;AACvC,6CAA2B;AAC3B,gEAA8C;AAC9C,kDAAgC;AAChC,sDAAoC;AACpC,gDAA8B;AAC9B,oDAAkC;AAClC,gDAA8B;AAC9B,0CAAwB;AACxB,8CAA4B;AAC5B,gDAA8B;AAC9B,gDAA8B;AAC9B,kDAAgC;AAChC,8CAA4B;AAC5B,8CAA4B"}
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/scope/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,+CAA6B;AAC7B,+DAA6C;AAC7C,+CAA6B;AAC7B,yDAAuC;AACvC,6CAA2B;AAC3B,gEAA8C;AAC9C,kDAAgC;AAChC,sDAAoC;AACpC,gDAA8B;AAC9B,oDAAkC;AAClC,gDAA8B;AAE9B,8CAA4B;AAC5B,gDAA8B;AAC9B,gDAA8B;AAC9B,kDAAgC;AAChC,8CAA4B;AAC5B,8CAA4B"}

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/scope-manager",
"version": "8.6.0",
"version": "8.7.0",
"description": "TypeScript scope analyser for ESLint",
"files": [
"dist",
@ -46,13 +46,13 @@
"typecheck": "npx nx typecheck"
},
"dependencies": {
"@typescript-eslint/types": "8.6.0",
"@typescript-eslint/visitor-keys": "8.6.0"
"@typescript-eslint/types": "8.7.0",
"@typescript-eslint/visitor-keys": "8.7.0"
},
"devDependencies": {
"@jest/types": "29.6.3",
"@types/glob": "*",
"@typescript-eslint/typescript-estree": "8.6.0",
"@typescript-eslint/typescript-estree": "8.7.0",
"glob": "*",
"jest-specific-snapshot": "*",
"make-dir": "*",

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/type-utils",
"version": "8.6.0",
"version": "8.7.0",
"description": "Type utilities for working with TypeScript + ESLint together",
"files": [
"dist",
@ -46,14 +46,14 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@typescript-eslint/typescript-estree": "8.6.0",
"@typescript-eslint/utils": "8.6.0",
"@typescript-eslint/typescript-estree": "8.7.0",
"@typescript-eslint/utils": "8.7.0",
"debug": "^4.3.4",
"ts-api-utils": "^1.3.0"
},
"devDependencies": {
"@jest/types": "29.6.3",
"@typescript-eslint/parser": "8.6.0",
"@typescript-eslint/parser": "8.7.0",
"ajv": "^6.12.6",
"downlevel-dts": "*",
"jest": "29.7.0",

View file

@ -1,5 +1,5 @@
export { AST_NODE_TYPES, AST_TOKEN_TYPES } from './generated/ast-spec';
export * from './lib';
export * from './parser-options';
export type * from './lib';
export type * from './parser-options';
export * from './ts-estree';
//# sourceMappingURL=index.d.ts.map

View file

@ -1 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvE,cAAc,OAAO,CAAC;AACtB,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC"}
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvE,mBAAmB,OAAO,CAAC;AAC3B,mBAAmB,kBAAkB,CAAC;AACtC,cAAc,aAAa,CAAC"}

View file

@ -18,7 +18,5 @@ exports.AST_TOKEN_TYPES = exports.AST_NODE_TYPES = void 0;
var ast_spec_1 = require("./generated/ast-spec");
Object.defineProperty(exports, "AST_NODE_TYPES", { enumerable: true, get: function () { return ast_spec_1.AST_NODE_TYPES; } });
Object.defineProperty(exports, "AST_TOKEN_TYPES", { enumerable: true, get: function () { return ast_spec_1.AST_TOKEN_TYPES; } });
__exportStar(require("./lib"), exports);
__exportStar(require("./parser-options"), exports);
__exportStar(require("./ts-estree"), exports);
//# sourceMappingURL=index.js.map

View file

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,iDAAuE;AAA9D,0GAAA,cAAc,OAAA;AAAE,2GAAA,eAAe,OAAA;AACxC,wCAAsB;AACtB,mDAAiC;AACjC,8CAA4B"}
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,iDAAuE;AAA9D,0GAAA,cAAc,OAAA;AAAE,2GAAA,eAAe,OAAA;AAGxC,8CAA4B"}

View file

@ -106,7 +106,7 @@ declare module './generated/ast-spec' {
parent: TSESTree.ClassBody;
}
interface SpreadElement {
parent: TSESTree.ArrayExpression | TSESTree.CallExpression | TSESTree.ObjectExpression;
parent: TSESTree.ArrayExpression | TSESTree.CallExpression | TSESTree.NewExpression | TSESTree.ObjectExpression;
}
interface StaticBlock {
parent: TSESTree.ClassBody;

View file

@ -1 +1 @@
{"version":3,"file":"ts-estree.d.ts","sourceRoot":"","sources":["../src/ts-estree.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,QAAQ,MAAM,sBAAsB,CAAC;AAGtD,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,QAAQ;QAChB,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC;KACvB;IAED,UAAU,OAAO;QACf;;WAEG;QACH,MAAM,CAAC,EAAE,KAAK,CAAC;KAChB;IAED,UAAU,4BAA4B;QACpC,MAAM,EAAE,QAAQ,CAAC,SAAS,CAAC;KAC5B;IACD,UAAU,+BAA+B;QACvC,MAAM,EAAE,QAAQ,CAAC,SAAS,CAAC;KAC5B;IAED,UAAU,oCAAoC;QAC5C,MAAM,EAAE,QAAQ,CAAC,mBAAmB,CAAC;KACtC;IAED,UAAU,2BAA2B;QACnC,MAAM,EAAE,QAAQ,CAAC,mBAAmB,CAAC;KACtC;IAED,UAAU,wBAAwB;QAChC,MAAM,EAAE,QAAQ,CAAC,mBAAmB,CAAC;KACtC;IAED,UAAU,sBAAsB;QAC9B,MAAM,EAAE,QAAQ,CAAC,mBAAmB,CAAC;KACtC;IAED,UAAU,8BAA8B;QACtC,MAAM,EAAE,QAAQ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B,QAAQ,CAAC,aAAa,CAAC;KAC5B;IAED,UAAU,eAAe;QACvB,MAAM,EAAE,QAAQ,CAAC,sBAAsB,CAAC;KACzC;IAED,UAAU,mBAAmB;QAC3B,MAAM,EAAE,QAAQ,CAAC,eAAe,CAAC;KAClC;IAED,UAAU,6BAA6B;QACrC,MAAM,EAAE,QAAQ,CAAC,eAAe,GAAG,QAAQ,CAAC,aAAa,CAAC;KAC3D;IACD,UAAU,gCAAgC;QACxC,MAAM,EAAE,QAAQ,CAAC,eAAe,GAAG,QAAQ,CAAC,aAAa,CAAC;KAC3D;IAED,UAAU,aAAa;QACrB,MAAM,EAAE,QAAQ,CAAC,mBAAmB,CAAC;KACtC;IAED,UAAU,mBAAmB;QAC3B,MAAM,EAAE,QAAQ,CAAC,YAAY,CAAC;KAC/B;IAED,UAAU,+BAA+B;QACvC,MAAM,EAAE,QAAQ,CAAC,eAAe,GAAG,QAAQ,CAAC,aAAa,CAAC;KAC3D;IACD,UAAU,kCAAkC;QAC1C,MAAM,EAAE,QAAQ,CAAC,eAAe,GAAG,QAAQ,CAAC,aAAa,CAAC;KAC3D;IAED,UAAU,eAAe;QACvB,MAAM,EACF,QAAQ,CAAC,WAAW,GACpB,QAAQ,CAAC,YAAY,GACrB,QAAQ,CAAC,0BAA0B,CAAC;KACzC;CACF;AAED,OAAO,KAAK,QAAQ,MAAM,sBAAsB,CAAC"}

View file

@ -1 +1 @@
{"version":3,"file":"ts-estree.js","sourceRoot":"","sources":["../src/ts-estree.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA+NA,iEAAiD"}
{"version":3,"file":"ts-estree.js","sourceRoot":"","sources":["../src/ts-estree.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAgOA,iEAAiD"}

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/types",
"version": "8.6.0",
"version": "8.7.0",
"description": "Types for the TypeScript-ESTree AST spec",
"files": [
"dist",

View file

@ -1,4 +1,4 @@
export { AST_NODE_TYPES, AST_TOKEN_TYPES, TSESTree, } from '@typescript-eslint/types';
export * from './ts-nodes';
export * from './estree-to-ts-node-types';
export type * from './ts-nodes';
export type * from './estree-to-ts-node-types';
//# sourceMappingURL=index.d.ts.map

View file

@ -1 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ts-estree/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,eAAe,EACf,QAAQ,GACT,MAAM,0BAA0B,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,2BAA2B,CAAC"}
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ts-estree/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,eAAe,EACf,QAAQ,GACT,MAAM,0BAA0B,CAAC;AAClC,mBAAmB,YAAY,CAAC;AAChC,mBAAmB,2BAA2B,CAAC"}

View file

@ -1,18 +1,4 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TSESTree = exports.AST_TOKEN_TYPES = exports.AST_NODE_TYPES = void 0;
// for simplicity and backwards-compatibility
@ -20,6 +6,4 @@ var types_1 = require("@typescript-eslint/types");
Object.defineProperty(exports, "AST_NODE_TYPES", { enumerable: true, get: function () { return types_1.AST_NODE_TYPES; } });
Object.defineProperty(exports, "AST_TOKEN_TYPES", { enumerable: true, get: function () { return types_1.AST_TOKEN_TYPES; } });
Object.defineProperty(exports, "TSESTree", { enumerable: true, get: function () { return types_1.TSESTree; } });
__exportStar(require("./ts-nodes"), exports);
__exportStar(require("./estree-to-ts-node-types"), exports);
//# sourceMappingURL=index.js.map

View file

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ts-estree/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,6CAA6C;AAC7C,kDAIkC;AAHhC,uGAAA,cAAc,OAAA;AACd,wGAAA,eAAe,OAAA;AACf,iGAAA,QAAQ,OAAA;AAEV,6CAA2B;AAC3B,4DAA0C"}
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ts-estree/index.ts"],"names":[],"mappings":";;;AAAA,6CAA6C;AAC7C,kDAIkC;AAHhC,uGAAA,cAAc,OAAA;AACd,wGAAA,eAAe,OAAA;AACf,iGAAA,QAAQ,OAAA"}

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/typescript-estree",
"version": "8.6.0",
"version": "8.7.0",
"description": "A parser that converts TypeScript source code into an ESTree compatible form",
"files": [
"dist",
@ -54,8 +54,8 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@typescript-eslint/types": "8.6.0",
"@typescript-eslint/visitor-keys": "8.6.0",
"@typescript-eslint/types": "8.7.0",
"@typescript-eslint/visitor-keys": "8.7.0",
"debug": "^4.3.4",
"fast-glob": "^3.3.2",
"is-glob": "^4.0.3",

View file

@ -1,7 +1,7 @@
export * from './applyDefault';
export * from './deepMerge';
export * from './getParserServices';
export * from './InferTypesFromRule';
export type * from './InferTypesFromRule';
export * from './nullThrows';
export * from './RuleCreator';
//# sourceMappingURL=index.d.ts.map

View file

@ -1 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/eslint-utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC"}
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/eslint-utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,mBAAmB,sBAAsB,CAAC;AAC1C,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC"}

View file

@ -17,7 +17,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./applyDefault"), exports);
__exportStar(require("./deepMerge"), exports);
__exportStar(require("./getParserServices"), exports);
__exportStar(require("./InferTypesFromRule"), exports);
__exportStar(require("./nullThrows"), exports);
__exportStar(require("./RuleCreator"), exports);
//# sourceMappingURL=index.js.map

View file

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/eslint-utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,8CAA4B;AAC5B,sDAAoC;AACpC,uDAAqC;AACrC,+CAA6B;AAC7B,gDAA8B"}
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/eslint-utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,8CAA4B;AAC5B,sDAAoC;AAEpC,+CAA6B;AAC7B,gDAA8B"}

View file

@ -1,6 +1,6 @@
export * as ASTUtils from './ast-utils';
export * as ESLintUtils from './eslint-utils';
export * as JSONSchema from './json-schema';
export type * as JSONSchema from './json-schema';
export * as TSESLint from './ts-eslint';
export * from './ts-estree';
export * as TSUtils from './ts-utils';

View file

@ -1 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAC;AAExC,OAAO,KAAK,WAAW,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAC;AACxC,cAAc,aAAa,CAAC;AAC5B,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC"}
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAC;AAExC,OAAO,KAAK,WAAW,MAAM,gBAAgB,CAAC;AAC9C,YAAY,KAAK,UAAU,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAC;AACxC,cAAc,aAAa,CAAC;AAC5B,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC"}

View file

@ -26,10 +26,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TSUtils = exports.TSESLint = exports.JSONSchema = exports.ESLintUtils = exports.ASTUtils = void 0;
exports.TSUtils = exports.TSESLint = exports.ESLintUtils = exports.ASTUtils = void 0;
exports.ASTUtils = __importStar(require("./ast-utils"));
exports.ESLintUtils = __importStar(require("./eslint-utils"));
exports.JSONSchema = __importStar(require("./json-schema"));
exports.TSESLint = __importStar(require("./ts-eslint"));
__exportStar(require("./ts-estree"), exports);
exports.TSUtils = __importStar(require("./ts-utils"));

View file

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wDAAwC;AAExC,8DAA8C;AAC9C,4DAA4C;AAC5C,wDAAwC;AACxC,8CAA4B;AAC5B,sDAAsC"}
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wDAAwC;AAExC,8DAA8C;AAE9C,wDAAwC;AACxC,8CAA4B;AAC5B,sDAAsC"}

View file

@ -322,7 +322,6 @@ interface RuleListenerBaseSelectors {
AssignmentExpression?: RuleFunction<TSESTree.AssignmentExpression>;
AssignmentPattern?: RuleFunction<TSESTree.AssignmentPattern>;
AwaitExpression?: RuleFunction<TSESTree.AwaitExpression>;
BigIntLiteral?: RuleFunction<TSESTree.BigIntLiteral>;
BinaryExpression?: RuleFunction<TSESTree.BinaryExpression>;
BlockStatement?: RuleFunction<TSESTree.BlockStatement>;
BreakStatement?: RuleFunction<TSESTree.BreakStatement>;
@ -350,6 +349,7 @@ interface RuleListenerBaseSelectors {
FunctionExpression?: RuleFunction<TSESTree.FunctionExpression>;
Identifier?: RuleFunction<TSESTree.Identifier>;
IfStatement?: RuleFunction<TSESTree.IfStatement>;
ImportAttribute?: RuleFunction<TSESTree.ImportAttribute>;
ImportDeclaration?: RuleFunction<TSESTree.ImportDeclaration>;
ImportDefaultSpecifier?: RuleFunction<TSESTree.ImportDefaultSpecifier>;
ImportExpression?: RuleFunction<TSESTree.ImportExpression>;
@ -364,6 +364,7 @@ interface RuleListenerBaseSelectors {
JSXFragment?: RuleFunction<TSESTree.JSXFragment>;
JSXIdentifier?: RuleFunction<TSESTree.JSXIdentifier>;
JSXMemberExpression?: RuleFunction<TSESTree.JSXMemberExpression>;
JSXNamespacedName?: RuleFunction<TSESTree.JSXNamespacedName>;
JSXOpeningElement?: RuleFunction<TSESTree.JSXOpeningElement>;
JSXOpeningFragment?: RuleFunction<TSESTree.JSXOpeningFragment>;
JSXSpreadAttribute?: RuleFunction<TSESTree.JSXSpreadAttribute>;
@ -378,6 +379,7 @@ interface RuleListenerBaseSelectors {
NewExpression?: RuleFunction<TSESTree.NewExpression>;
ObjectExpression?: RuleFunction<TSESTree.ObjectExpression>;
ObjectPattern?: RuleFunction<TSESTree.ObjectPattern>;
PrivateIdentifier?: RuleFunction<TSESTree.PrivateIdentifier>;
Program?: RuleFunction<TSESTree.Program>;
Property?: RuleFunction<TSESTree.Property>;
PropertyDefinition?: RuleFunction<TSESTree.PropertyDefinition>;
@ -385,6 +387,7 @@ interface RuleListenerBaseSelectors {
ReturnStatement?: RuleFunction<TSESTree.ReturnStatement>;
SequenceExpression?: RuleFunction<TSESTree.SequenceExpression>;
SpreadElement?: RuleFunction<TSESTree.SpreadElement>;
StaticBlock?: RuleFunction<TSESTree.StaticBlock>;
Super?: RuleFunction<TSESTree.Super>;
SwitchCase?: RuleFunction<TSESTree.SwitchCase>;
SwitchStatement?: RuleFunction<TSESTree.SwitchStatement>;
@ -394,6 +397,7 @@ interface RuleListenerBaseSelectors {
ThisExpression?: RuleFunction<TSESTree.ThisExpression>;
ThrowStatement?: RuleFunction<TSESTree.ThrowStatement>;
TryStatement?: RuleFunction<TSESTree.TryStatement>;
TSAbstractAccessorProperty?: RuleFunction<TSESTree.TSAbstractAccessorProperty>;
TSAbstractKeyword?: RuleFunction<TSESTree.TSAbstractKeyword>;
TSAbstractMethodDefinition?: RuleFunction<TSESTree.TSAbstractMethodDefinition>;
TSAbstractPropertyDefinition?: RuleFunction<TSESTree.TSAbstractPropertyDefinition>;
@ -411,6 +415,7 @@ interface RuleListenerBaseSelectors {
TSDeclareFunction?: RuleFunction<TSESTree.TSDeclareFunction>;
TSDeclareKeyword?: RuleFunction<TSESTree.TSDeclareKeyword>;
TSEmptyBodyFunctionExpression?: RuleFunction<TSESTree.TSEmptyBodyFunctionExpression>;
TSEnumBody?: RuleFunction<TSESTree.TSEnumBody>;
TSEnumDeclaration?: RuleFunction<TSESTree.TSEnumDeclaration>;
TSEnumMember?: RuleFunction<TSESTree.TSEnumMember>;
TSExportAssignment?: RuleFunction<TSESTree.TSExportAssignment>;
@ -422,15 +427,18 @@ interface RuleListenerBaseSelectors {
TSIndexedAccessType?: RuleFunction<TSESTree.TSIndexedAccessType>;
TSIndexSignature?: RuleFunction<TSESTree.TSIndexSignature>;
TSInferType?: RuleFunction<TSESTree.TSInferType>;
TSInstantiationExpression?: RuleFunction<TSESTree.TSInstantiationExpression>;
TSInterfaceBody?: RuleFunction<TSESTree.TSInterfaceBody>;
TSInterfaceDeclaration?: RuleFunction<TSESTree.TSInterfaceDeclaration>;
TSInterfaceHeritage?: RuleFunction<TSESTree.TSInterfaceHeritage>;
TSIntersectionType?: RuleFunction<TSESTree.TSIntersectionType>;
TSIntrinsicKeyword?: RuleFunction<TSESTree.TSIntrinsicKeyword>;
TSLiteralType?: RuleFunction<TSESTree.TSLiteralType>;
TSMappedType?: RuleFunction<TSESTree.TSMappedType>;
TSMethodSignature?: RuleFunction<TSESTree.TSMethodSignature>;
TSModuleBlock?: RuleFunction<TSESTree.TSModuleBlock>;
TSModuleDeclaration?: RuleFunction<TSESTree.TSModuleDeclaration>;
TSNamedTupleMember?: RuleFunction<TSESTree.TSNamedTupleMember>;
TSNamespaceExportDeclaration?: RuleFunction<TSESTree.TSNamespaceExportDeclaration>;
TSNeverKeyword?: RuleFunction<TSESTree.TSNeverKeyword>;
TSNonNullExpression?: RuleFunction<TSESTree.TSNonNullExpression>;
@ -450,6 +458,7 @@ interface RuleListenerBaseSelectors {
TSStaticKeyword?: RuleFunction<TSESTree.TSStaticKeyword>;
TSStringKeyword?: RuleFunction<TSESTree.TSStringKeyword>;
TSSymbolKeyword?: RuleFunction<TSESTree.TSSymbolKeyword>;
TSTemplateLiteralType?: RuleFunction<TSESTree.TSTemplateLiteralType>;
TSThisType?: RuleFunction<TSESTree.TSThisType>;
TSTupleType?: RuleFunction<TSESTree.TSTupleType>;
TSTypeAliasDeclaration?: RuleFunction<TSESTree.TSTypeAliasDeclaration>;

File diff suppressed because one or more lines are too long

View file

@ -1,11 +1,11 @@
export * from './AST';
export * from './Config';
export type * from './AST';
export type * from './Config';
export * from './ESLint';
export * from './Linter';
export * from './Parser';
export * from './ParserOptions';
export * from './Processor';
export * from './Rule';
export type * from './Parser';
export type * from './ParserOptions';
export type * from './Processor';
export type * from './Rule';
export * from './RuleTester';
export * from './Scope';
export * from './SourceCode';

View file

@ -1 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ts-eslint/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC"}
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ts-eslint/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,OAAO,CAAC;AAC3B,mBAAmB,UAAU,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,mBAAmB,UAAU,CAAC;AAC9B,mBAAmB,iBAAiB,CAAC;AACrC,mBAAmB,aAAa,CAAC;AACjC,mBAAmB,QAAQ,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC"}

View file

@ -14,14 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./AST"), exports);
__exportStar(require("./Config"), exports);
__exportStar(require("./ESLint"), exports);
__exportStar(require("./Linter"), exports);
__exportStar(require("./Parser"), exports);
__exportStar(require("./ParserOptions"), exports);
__exportStar(require("./Processor"), exports);
__exportStar(require("./Rule"), exports);
__exportStar(require("./RuleTester"), exports);
__exportStar(require("./Scope"), exports);
__exportStar(require("./SourceCode"), exports);

View file

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ts-eslint/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,2CAAyB;AACzB,2CAAyB;AACzB,2CAAyB;AACzB,2CAAyB;AACzB,kDAAgC;AAChC,8CAA4B;AAC5B,yCAAuB;AACvB,+CAA6B;AAC7B,0CAAwB;AACxB,+CAA6B"}
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ts-eslint/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAEA,2CAAyB;AACzB,2CAAyB;AAKzB,+CAA6B;AAC7B,0CAAwB;AACxB,+CAA6B"}

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/utils",
"version": "8.6.0",
"version": "8.7.0",
"description": "Utilities for working with TypeScript + ESLint together",
"files": [
"dist",
@ -64,9 +64,9 @@
},
"dependencies": {
"@eslint-community/eslint-utils": "^4.4.0",
"@typescript-eslint/scope-manager": "8.6.0",
"@typescript-eslint/types": "8.6.0",
"@typescript-eslint/typescript-estree": "8.6.0"
"@typescript-eslint/scope-manager": "8.7.0",
"@typescript-eslint/types": "8.7.0",
"@typescript-eslint/typescript-estree": "8.7.0"
},
"peerDependencies": {
"eslint": "^8.57.0 || ^9.0.0"

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/visitor-keys",
"version": "8.6.0",
"version": "8.7.0",
"description": "Visitor keys used to help traverse the TypeScript-ESTree AST",
"files": [
"dist",
@ -47,7 +47,7 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@typescript-eslint/types": "8.6.0",
"@typescript-eslint/types": "8.7.0",
"eslint-visitor-keys": "^3.4.3"
},
"devDependencies": {

View file

@ -6,6 +6,34 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
## [Unreleased]
## [2.30.0] - 2024-09-02
### Added
- [`dynamic-import-chunkname`]: add `allowEmpty` option to allow empty leading comments ([#2942], thanks [@JiangWeixian])
- [`dynamic-import-chunkname`]: Allow empty chunk name when webpackMode: 'eager' is set; add suggestions to remove name in eager mode ([#3004], thanks [@amsardesai])
- [`no-unused-modules`]: Add `ignoreUnusedTypeExports` option ([#3011], thanks [@silverwind])
- add support for Flat Config ([#3018], thanks [@michaelfaith])
### Fixed
- [`no-extraneous-dependencies`]: allow wrong path ([#3012], thanks [@chabb])
- [`no-cycle`]: use scc algorithm to optimize ([#2998], thanks [@soryy708])
- [`no-duplicates`]: Removing duplicates breaks in TypeScript ([#3033], thanks [@yesl-kim])
- [`newline-after-import`]: fix considerComments option when require ([#2952], thanks [@developer-bandi])
- [`order`]: do not compare first path segment for relative paths ([#2682]) ([#2885], thanks [@mihkeleidast])
### Changed
- [Docs] `no-extraneous-dependencies`: Make glob pattern description more explicit ([#2944], thanks [@mulztob])
- [`no-unused-modules`]: add console message to help debug [#2866]
- [Refactor] `ExportMap`: make procedures static instead of monkeypatching exportmap ([#2982], thanks [@soryy708])
- [Refactor] `ExportMap`: separate ExportMap instance from its builder logic ([#2985], thanks [@soryy708])
- [Docs] `order`: Add a quick note on how unbound imports and --fix ([#2640], thanks [@minervabot])
- [Tests] appveyor -> GHA (run tests on Windows in both pwsh and WSL + Ubuntu) ([#2987], thanks [@joeyguerra])
- [actions] migrate OSX tests to GHA ([ljharb#37], thanks [@aks-])
- [Refactor] `exportMapBuilder`: avoid hoisting ([#2989], thanks [@soryy708])
- [Refactor] `ExportMap`: extract "builder" logic to separate files ([#2991], thanks [@soryy708])
- [Docs] [`order`]: update the description of the `pathGroupsExcludedImportTypes` option ([#3036], thanks [@liby])
- [readme] Clarify how to install the plugin ([#2993], thanks [@jwbth])
## [2.29.1] - 2023-12-14
### Fixed
@ -1101,8 +1129,26 @@ for info on changes for earlier releases.
[`memo-parser`]: ./memo-parser/README.md
[#3036]: https://github.com/import-js/eslint-plugin-import/pull/3036
[#3033]: https://github.com/import-js/eslint-plugin-import/pull/3033
[#3018]: https://github.com/import-js/eslint-plugin-import/pull/3018
[#3012]: https://github.com/import-js/eslint-plugin-import/pull/3012
[#3011]: https://github.com/import-js/eslint-plugin-import/pull/3011
[#3004]: https://github.com/import-js/eslint-plugin-import/pull/3004
[#2998]: https://github.com/import-js/eslint-plugin-import/pull/2998
[#2993]: https://github.com/import-js/eslint-plugin-import/pull/2993
[#2991]: https://github.com/import-js/eslint-plugin-import/pull/2991
[#2989]: https://github.com/import-js/eslint-plugin-import/pull/2989
[#2987]: https://github.com/import-js/eslint-plugin-import/pull/2987
[#2985]: https://github.com/import-js/eslint-plugin-import/pull/2985
[#2982]: https://github.com/import-js/eslint-plugin-import/pull/2982
[#2952]: https://github.com/import-js/eslint-plugin-import/pull/2952
[#2944]: https://github.com/import-js/eslint-plugin-import/pull/2944
[#2942]: https://github.com/import-js/eslint-plugin-import/pull/2942
[#2919]: https://github.com/import-js/eslint-plugin-import/pull/2919
[#2885]: https://github.com/import-js/eslint-plugin-import/pull/2885
[#2884]: https://github.com/import-js/eslint-plugin-import/pull/2884
[#2866]: https://github.com/import-js/eslint-plugin-import/pull/2866
[#2854]: https://github.com/import-js/eslint-plugin-import/pull/2854
[#2851]: https://github.com/import-js/eslint-plugin-import/pull/2851
[#2850]: https://github.com/import-js/eslint-plugin-import/pull/2850
@ -1116,6 +1162,7 @@ for info on changes for earlier releases.
[#2735]: https://github.com/import-js/eslint-plugin-import/pull/2735
[#2699]: https://github.com/import-js/eslint-plugin-import/pull/2699
[#2664]: https://github.com/import-js/eslint-plugin-import/pull/2664
[#2640]: https://github.com/import-js/eslint-plugin-import/pull/2640
[#2613]: https://github.com/import-js/eslint-plugin-import/pull/2613
[#2608]: https://github.com/import-js/eslint-plugin-import/pull/2608
[#2605]: https://github.com/import-js/eslint-plugin-import/pull/2605
@ -1440,9 +1487,12 @@ for info on changes for earlier releases.
[#164]: https://github.com/import-js/eslint-plugin-import/pull/164
[#157]: https://github.com/import-js/eslint-plugin-import/pull/157
[ljharb#37]: https://github.com/ljharb/eslint-plugin-import/pull/37
[#2930]: https://github.com/import-js/eslint-plugin-import/issues/2930
[#2687]: https://github.com/import-js/eslint-plugin-import/issues/2687
[#2684]: https://github.com/import-js/eslint-plugin-import/issues/2684
[#2682]: https://github.com/import-js/eslint-plugin-import/issues/2682
[#2674]: https://github.com/import-js/eslint-plugin-import/issues/2674
[#2668]: https://github.com/import-js/eslint-plugin-import/issues/2668
[#2666]: https://github.com/import-js/eslint-plugin-import/issues/2666
@ -1567,7 +1617,8 @@ for info on changes for earlier releases.
[#119]: https://github.com/import-js/eslint-plugin-import/issues/119
[#89]: https://github.com/import-js/eslint-plugin-import/issues/89
[Unreleased]: https://github.com/import-js/eslint-plugin-import/compare/v2.29.1...HEAD
[Unreleased]: https://github.com/import-js/eslint-plugin-import/compare/v2.30.0...HEAD
[2.30.0]: https://github.com/import-js/eslint-plugin-import/compare/v2.29.1...v2.30.0
[2.29.1]: https://github.com/import-js/eslint-plugin-import/compare/v2.29.0...v2.29.1
[2.29.0]: https://github.com/import-js/eslint-plugin-import/compare/v2.28.1...v2.29.0
[2.28.1]: https://github.com/import-js/eslint-plugin-import/compare/v2.28.0...v2.28.1
@ -1672,9 +1723,11 @@ for info on changes for earlier releases.
[@adjerbetian]: https://github.com/adjerbetian
[@AdriAt360]: https://github.com/AdriAt360
[@ai]: https://github.com/ai
[@aks-]: https://github.com/aks-
[@aladdin-add]: https://github.com/aladdin-add
[@alex-page]: https://github.com/alex-page
[@alexgorbatchev]: https://github.com/alexgorbatchev
[@amsardesai]: https://github.com/amsardesai
[@andreubotella]: https://github.com/andreubotella
[@AndrewLeedham]: https://github.com/AndrewLeedham
[@andyogo]: https://github.com/andyogo
@ -1699,11 +1752,13 @@ for info on changes for earlier releases.
[@bicstone]: https://github.com/bicstone
[@Blasz]: https://github.com/Blasz
[@bmish]: https://github.com/bmish
[@developer-bandi]: https://github.com/developer-bandi
[@borisyankov]: https://github.com/borisyankov
[@bradennapier]: https://github.com/bradennapier
[@bradzacher]: https://github.com/bradzacher
[@brendo]: https://github.com/brendo
[@brettz9]: https://github.com/brettz9
[@chabb]: https://github.com/chabb
[@Chamion]: https://github.com/Chamion
[@charlessuh]: https://github.com/charlessuh
[@charpeni]: https://github.com/charpeni
@ -1770,10 +1825,12 @@ for info on changes for earlier releases.
[@jeffshaver]: https://github.com/jeffshaver
[@jf248]: https://github.com/jf248
[@jfmengels]: https://github.com/jfmengels
[@JiangWeixian]: https://github.com/JiangWeixian
[@jimbolla]: https://github.com/jimbolla
[@jkimbo]: https://github.com/jkimbo
[@joaovieira]: https://github.com/joaovieira
[@joe-matsec]: https://github.com/joe-matsec
[@joeyguerra]: https://github.com/joeyguerra
[@johndevedu]: https://github.com/johndevedu
[@johnthagen]: https://github.com/johnthagen
[@jonboiser]: https://github.com/jonboiser
@ -1783,6 +1840,7 @@ for info on changes for earlier releases.
[@jseminck]: https://github.com/jseminck
[@julien1619]: https://github.com/julien1619
[@justinanastos]: https://github.com/justinanastos
[@jwbth]: https://github.com/jwbth
[@k15a]: https://github.com/k15a
[@kentcdodds]: https://github.com/kentcdodds
[@kevin940726]: https://github.com/kevin940726
@ -1830,11 +1888,15 @@ for info on changes for earlier releases.
[@meowtec]: https://github.com/meowtec
[@mgwalker]: https://github.com/mgwalker
[@mhmadhamster]: https://github.com/MhMadHamster
[@michaelfaith]: https://github.com/michaelfaith
[@mihkeleidast]: https://github.com/mihkeleidast
[@MikeyBeLike]: https://github.com/MikeyBeLike
[@minervabot]: https://github.com/minervabot
[@mpint]: https://github.com/mpint
[@mplewis]: https://github.com/mplewis
[@mrmckeb]: https://github.com/mrmckeb
[@msvab]: https://github.com/msvab
[@mulztob]: https://github.com/mulztob
[@mx-bernhard]: https://github.com/mx-bernhard
[@Nfinished]: https://github.com/Nfinished
[@nickofthyme]: https://github.com/nickofthyme
@ -1843,9 +1905,9 @@ for info on changes for earlier releases.
[@ntdb]: https://github.com/ntdb
[@nwalters512]: https://github.com/nwalters512
[@ombene]: https://github.com/ombene
[@Pandemic1617]: https://github.com/Pandemic1617
[@ota-meshi]: https://github.com/ota-meshi
[@OutdatedVersion]: https://github.com/OutdatedVersion
[@Pandemic1617]: https://github.com/Pandemic1617
[@panrafal]: https://github.com/panrafal
[@paztis]: https://github.com/paztis
[@pcorpet]: https://github.com/pcorpet
@ -1877,6 +1939,7 @@ for info on changes for earlier releases.
[@sergei-startsev]: https://github.com/sergei-startsev
[@sharmilajesupaul]: https://github.com/sharmilajesupaul
[@sheepsteak]: https://github.com/sheepsteak
[@silverwind]: https://github.com/silverwind
[@silviogutierrez]: https://github.com/silviogutierrez
[@SimenB]: https://github.com/SimenB
[@simmo]: https://github.com/simmo
@ -1919,6 +1982,7 @@ for info on changes for earlier releases.
[@wtgtybhertgeghgtwtg]: https://github.com/wtgtybhertgeghgtwtg
[@xM8WVqaG]: https://github.com/xM8WVqaG
[@xpl]: https://github.com/xpl
[@yesl-kim]: https://github.com/yesl-kim
[@yndajas]: https://github.com/yndajas
[@yordis]: https://github.com/yordis
[@Zamiell]: https://github.com/Zamiell

View file

@ -1,84 +0,0 @@
# Contributing
Thanks for your interest in helping out! Here are a **few** _weird_ tricks to ~~cut your mortgage in half~~ maximize the global net efficiency of your efforts!
## TL;DR: Checklist
When opening an [issue](#issues):
- [ ] search open/closed issues
- [ ] discuss bug/enhancement in new or old issue
[PR](#prs) time:
- [ ] write tests
- [ ] implement feature/fix bug
- [ ] update docs
- [ ] make a note in change log
Remember, you don't need to do it all yourself; any of these are helpful! 😎
## How to get started
If you are new to `eslint`, below are a few resources that will help you to familiarize yourself with the project.
- Watch [this presentation](https://www.youtube.com/watch?v=2W9tUnALrLg) to learn the fundamental concept of Abstract Syntax Trees (AST) and the way `eslint` works under the hood.
- Familiarize yourself with the [AST explorer](https://astexplorer.net/) tool. Look into rules in `docs/rules`, create patterns in the rules, then analyze its AST.
- Explore the blog posts on how to create a custom rule. [One blog post](https://blog.yonatan.dev/writing-a-custom-eslint-rule-to-spot-undeclared-props/). [Second blog post](https://betterprogramming.pub/creating-custom-eslint-rules-cdc579694608).
- Read the official `eslint` [developer guide](https://eslint.org/docs/latest/developer-guide/architecture/).
## Issues
### Search open + closed issues for similar cases
You may find an open issue that closely matches what you are thinking. You may also find a closed issue with discussion that either solves your problem or explains why we are unlikely to solve it in the near future.
If you find a matching issue that is open, and marked `accepted` and/or `help wanted`, you might want to [open a PR](#prs).
### Open an issue
Let's discuss your issue. Could be as simple as unclear documentation or a wonky config file.
If you're suggesting a feature, it might exist and need better documentation, or it might be in process. Even given those, some discussion might be warranted to ensure the enhancement is clear.
You're welcome to jump right to a PR, but without a discussion, can't make any guarantees about merging.
That said: sometimes seeing the code makes the discussion clearer.😄
This is a helpful contribution all by itself. Thanks!
## PRs
If you would like to implement something, firstly: thanks! Community contributions are a magical thing. Like Redux or [the flux capacitor](https://youtu.be/SR5BfQ4rEqQ?t=2m25s), they make open source possible.
**Working on your first Pull Request?**
You can learn how from this _free_ series [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github).
Here are some things to keep in mind when working on a PR:
**Trying to update an inactive Pull Request?**
If a PR is open, but unfortunately the author is, for any reason, not available to apply code review fixes or rebase the source branch, then please **do not open a new PR**.
Instead, paste a link to your own branch in the PR, and the maintainers can pull in your changes and update the existing PR in-place.
### Tests
A PR that is just failing test cases for an existing issue is very helpful, as this can take as much time (if not more) as it takes to implement a new feature or fix a bug.
If you only have enough time to write tests, fantastic! Submit away. This is a great jumping-off point for a core contributor or even another PR to continue what you've started.
### Docs
For enhancements to rules, please update the docs in `docs/rules` matching the rule filename from `src/rules` or the rule description in `meta.docs.description`. Running `npm run update:eslint-docs` will update the [README.md] and rule doc header.
Bugfixes may not warrant docs changes, though it's worth skimming the existing docs to see if there are any relevant caveats that need to be removed.
### Changelog
Please add a quick blurb to the [**Unreleased**](./CHANGELOG.md#unreleased) section of the change log. Give yourself some credit, and please link back to the PR for future reference. This is especially helpful for resolver changes, as the resolvers are less frequently modified and published.
Note also that the change log can't magically link back to Github entities (i.e. PRs, issues, users) or rules; there are a handful of footnote URL definitions at the bottom. You may need to add one or more URL if you've square-bracketed any such items.
## Code of Conduct
Please familiarize yourself with the [Code of Conduct](https://github.com/import-js/.github/blob/main/CODE_OF_CONDUCT.md).
[README.md]: ./README.md

View file

@ -23,7 +23,7 @@ This plugin intends to support linting of ES2015+ (ES6+) import/export syntax, a
⌨️ Set in the `typescript` configuration.\
🚸 Set in the `warnings` configuration.\
🔧 Automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--fix).\
💡 Manually fixable by [editor suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).\
💡 Manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions).\
❌ Deprecated.
### Helpful warnings
@ -73,7 +73,7 @@ This plugin intends to support linting of ES2015+ (ES6+) import/export syntax, a
| Name                            | Description | 💼 | ⚠️ | 🚫 | 🔧 | 💡 | ❌ |
| :------------------------------------------------------------------------------- | :------------------------------------------------------------------------- | :- | :---- | :- | :- | :- | :- |
| [consistent-type-specifier-style](docs/rules/consistent-type-specifier-style.md) | Enforce or ban the use of inline type-only markers for named imports. | | | | 🔧 | | |
| [dynamic-import-chunkname](docs/rules/dynamic-import-chunkname.md) | Enforce a leading comment with the webpackChunkName for dynamic imports. | | | | | | |
| [dynamic-import-chunkname](docs/rules/dynamic-import-chunkname.md) | Enforce a leading comment with the webpackChunkName for dynamic imports. | | | | | 💡 | |
| [exports-last](docs/rules/exports-last.md) | Ensure all exports appear after other statements. | | | | | | |
| [extensions](docs/rules/extensions.md) | Ensure consistent use of file extension within the import path. | | | | | | |
| [first](docs/rules/first.md) | Ensure all imports appear before other statements. | | | | 🔧 | | |
@ -106,29 +106,60 @@ The maintainers of `eslint-plugin-import` and thousands of other packages are wo
npm install eslint-plugin-import --save-dev
```
All rules are off by default. However, you may configure them manually
in your `.eslintrc.(yml|json|js)`, or extend one of the canned configs:
### Config - Legacy (`.eslintrc`)
```yaml
---
extends:
- eslint:recommended
- plugin:import/recommended
# alternatively, 'recommended' is the combination of these two rule sets:
- plugin:import/errors
- plugin:import/warnings
All rules are off by default. However, you may extend one of the preset configs, or configure them manually in your `.eslintrc.(yml|json|js)`.
# or configure manually:
plugins:
- import
- Extending a preset config:
rules:
import/no-unresolved: [2, {commonjs: true, amd: true}]
import/named: 2
import/namespace: 2
import/default: 2
import/export: 2
# etc...
```jsonc
{
"extends": [
"eslint:recommended",
"plugin:import/recommended",
],
}
```
- Configuring manually:
```jsonc
{
"rules": {
"import/no-unresolved": ["error", { "commonjs": true, "amd": true }]
"import/named": "error",
"import/namespace": "error",
"import/default": "error",
"import/export": "error",
// etc...
},
},
```
### Config - Flat (`eslint.config.js`)
All rules are off by default. However, you may configure them manually in your `eslint.config.(js|cjs|mjs)`, or extend one of the preset configs:
```js
import importPlugin from 'eslint-plugin-import';
import js from '@eslint/js';
export default [
js.configs.recommended,
importPlugin.flatConfigs.recommended,
{
files: ['**/*.{js,mjs,cjs}'],
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
rules: {
'no-unused-vars': 'off',
'import/no-dynamic-require': 'warn',
'import/no-nodejs-modules': 'warn',
},
},
];
```
## TypeScript
@ -137,18 +168,23 @@ You may use the following snippet or assemble your own config using the granular
Make sure you have installed [`@typescript-eslint/parser`] and [`eslint-import-resolver-typescript`] which are used in the following configuration.
```yaml
extends:
- eslint:recommended
- plugin:import/recommended
# the following lines do the trick
- plugin:import/typescript
settings:
import/resolver:
# You will also need to install and configure the TypeScript resolver
# See also https://github.com/import-js/eslint-import-resolver-typescript#configuration
typescript: true
node: true
```jsonc
{
"extends": [
"eslint:recommended",
"plugin:import/recommended",
// the following lines do the trick
"plugin:import/typescript",
],
"settings": {
"import/resolver": {
// You will also need to install and configure the TypeScript resolver
// See also https://github.com/import-js/eslint-import-resolver-typescript#configuration
"typescript": true,
"node": true,
},
},
}
```
[`@typescript-eslint/parser`]: https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser
@ -177,6 +213,16 @@ You can reference resolvers in several ways (in order of precedence):
- as a conventional `eslint-import-resolver` name, like `eslint-import-resolver-foo`:
```jsonc
// .eslintrc
{
"settings": {
// uses 'eslint-import-resolver-foo':
"import/resolver": "foo",
},
}
```
```yaml
# .eslintrc.yml
settings:
@ -197,6 +243,15 @@ module.exports = {
- with a full npm module name, like `my-awesome-npm-module`:
```jsonc
// .eslintrc
{
"settings": {
"import/resolver": "my-awesome-npm-module",
},
}
```
```yaml
# .eslintrc.yml
settings:
@ -292,11 +347,15 @@ In practice, this means rules other than [`no-unresolved`](./docs/rules/no-unres
`no-unresolved` has its own [`ignore`](./docs/rules/no-unresolved.md#ignore) setting.
```yaml
settings:
import/ignore:
- \.coffee$ # fraught with parse errors
- \.(scss|less|css)$ # can't parse unprocessed CSS modules, either
```jsonc
{
"settings": {
"import/ignore": [
"\.coffee$", // fraught with parse errors
"\.(scss|less|css)$", // can't parse unprocessed CSS modules, either
],
},
}
```
### `import/core-modules`
@ -315,10 +374,13 @@ import 'electron' // without extra config, will be flagged as unresolved!
that would otherwise be unresolved. To avoid this, you may provide `electron` as a
core module:
```yaml
# .eslintrc.yml
settings:
import/core-modules: [ electron ]
```jsonc
// .eslintrc
{
"settings": {
"import/core-modules": ["electron"],
},
}
```
In Electron's specific case, there is a shared config named `electron`
@ -351,11 +413,15 @@ dependency parser will require and use the map key as the parser instead of the
configured ESLint parser. This is useful if you're inter-op-ing with TypeScript
directly using webpack, for example:
```yaml
# .eslintrc.yml
settings:
import/parsers:
"@typescript-eslint/parser": [ .ts, .tsx ]
```jsonc
// .eslintrc
{
"settings": {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"],
},
},
}
```
In this case, [`@typescript-eslint/parser`](https://www.npmjs.com/package/@typescript-eslint/parser)
@ -385,20 +451,28 @@ For long-lasting processes, like [`eslint_d`] or [`eslint-loader`], however, it'
If you never use [`eslint_d`] or [`eslint-loader`], you may set the cache lifetime to `Infinity` and everything should be fine:
```yaml
# .eslintrc.yml
settings:
import/cache:
lifetime: ∞ # or Infinity
```jsonc
// .eslintrc
{
"settings": {
"import/cache": {
"lifetime": "∞", // or Infinity, in a JS config
},
},
}
```
Otherwise, set some integer, and cache entries will be evicted after that many seconds have elapsed:
```yaml
# .eslintrc.yml
settings:
import/cache:
lifetime: 5 # 30 is the default
```jsonc
// .eslintrc
{
"settings": {
"import/cache": {
"lifetime": 5, // 30 is the default
},
},
}
```
[`eslint_d`]: https://www.npmjs.com/package/eslint_d
@ -412,10 +486,13 @@ By default, any package referenced from [`import/external-module-folders`](#impo
For example, if your packages in a monorepo are all in `@scope`, you can configure `import/internal-regex` like this
```yaml
# .eslintrc.yml
settings:
import/internal-regex: ^@scope/
```jsonc
// .eslintrc
{
"settings": {
"import/internal-regex": "^@scope/",
},
}
```
## SublimeLinter-eslint

View file

@ -1,54 +0,0 @@
# Release steps
1. create a `release-[x.y.z]` branch from tip of `main` (or whatever release commit)
```bash
git checkout main && git pull && git checkout -b release-2.1.0
```
2. bump `package.json` + update CHANGELOG version links for all releasing packages (i.e., root + any resolvers)
In changelog for core plugin, normally leave [Unreleased] but update its link at the bottom
to be rooted at the new version's tag, and add a link for the new version rooted
at last version's tag.
```markdown
[Unreleased]: https://github.com/import-js/eslint-plugin-import/compare/v2.0.1...HEAD
[2.0.1]: https://github.com/import-js/eslint-plugin-import/compare/v2.0.0...v2.0.1
```
becomes
```markdown
[Unreleased]: https://github.com/import-js/eslint-plugin-import/compare/v2.1.0...HEAD
[2.1.0]: https://github.com/import-js/eslint-plugin-import/compare/v2.0.1...v2.1.0
[2.0.1]: https://github.com/import-js/eslint-plugin-import/compare/v2.0.0...v2.0.1
```
Generally, don't use `npm version` for this because it creates a tag, which I normally
wait until signoff from contributors and actually `npm publish`-ing to snap the tag.
3. create pull request from `release-[x.y.z]` into `release` branch
I like this because it
- lists all commits in the release
- provides a commentary location to discuss the release
- builds in CI and provides test results
4. iterate on feedback
- handle other issues
- merge more PRs
- fix issues in changelog/docs
5. `npm publish` from `release-[x.y.z]` branch
- don't forget resolvers!
6. tag commit (`v[x.y.z]`)
- again, not forgetting resolvers, if needed (`resolvers/[name]/v[t.u.v]`)
7. merge `release-[x.y.z]` into `release` (
- ideally fast-forward, probably with Git CLI instead of Github
8. merge `release` into `main`
Done!

View file

@ -0,0 +1,14 @@
/**
* unopinionated config. just the things that are necessarily runtime errors
* waiting to happen.
* @type {Object}
*/
module.exports = {
rules: {
'import/no-unresolved': 2,
'import/named': 2,
'import/namespace': 2,
'import/default': 2,
'import/export': 2,
},
};

19
node_modules/eslint-plugin-import/config/flat/react.js generated vendored Normal file
View file

@ -0,0 +1,19 @@
/**
* Adds `.jsx` as an extension, and enables JSX parsing.
*
* Even if _you_ aren't using JSX (or .jsx) directly, if your dependencies
* define jsnext:main and have JSX internally, you may run into problems
* if you don't enable these settings at the top level.
*/
module.exports = {
settings: {
'import/extensions': ['.js', '.jsx', '.mjs', '.cjs'],
},
languageOptions: {
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
};

View file

@ -0,0 +1,26 @@
/**
* The basics.
* @type {Object}
*/
module.exports = {
rules: {
// analysis/correctness
'import/no-unresolved': 'error',
'import/named': 'error',
'import/namespace': 'error',
'import/default': 'error',
'import/export': 'error',
// red flags (thus, warnings)
'import/no-named-as-default': 'warn',
'import/no-named-as-default-member': 'warn',
'import/no-duplicates': 'warn',
},
// need all these for parsing dependencies (even if _your_ code doesn't need
// all of them)
languageOptions: {
ecmaVersion: 2018,
sourceType: 'module',
},
};

View file

@ -0,0 +1,11 @@
/**
* more opinionated config.
* @type {Object}
*/
module.exports = {
rules: {
'import/no-named-as-default': 1,
'import/no-named-as-default-member': 1,
'import/no-duplicates': 1,
},
};

View file

@ -6,7 +6,6 @@
* if you don't enable these settings at the top level.
*/
module.exports = {
settings: {
'import/extensions': ['.js', '.jsx'],
},
@ -14,5 +13,4 @@ module.exports = {
parserOptions: {
ecmaFeatures: { jsx: true },
},
};

View file

@ -9,7 +9,7 @@
// `.ts`/`.tsx`/`.js`/`.jsx` implementation.
const typeScriptExtensions = ['.ts', '.cts', '.mts', '.tsx'];
const allExtensions = [...typeScriptExtensions, '.js', '.jsx'];
const allExtensions = [...typeScriptExtensions, '.js', '.jsx', '.mjs', '.cjs'];
module.exports = {
settings: {

View file

@ -1,5 +1,7 @@
# import/dynamic-import-chunkname
💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions).
<!-- end auto-generated rule header -->
This rule reports any dynamic imports without a webpackChunkName specified in a leading block comment in the proper format.
@ -15,7 +17,8 @@ You can also configure the regex format you'd like to accept for the webpackChun
{
"dynamic-import-chunkname": [2, {
importFunctions: ["dynamicImport"],
webpackChunknameFormat: "[a-zA-Z0-57-9-/_]+"
webpackChunknameFormat: "[a-zA-Z0-57-9-/_]+",
allowEmpty: false
}]
}
```
@ -55,6 +58,13 @@ import(
// webpackChunkName: "someModule"
'someModule',
);
// chunk names are disallowed when eager mode is set
import(
/* webpackMode: "eager" */
/* webpackChunkName: "someModule" */
'someModule',
)
```
### valid
@ -87,6 +97,38 @@ The following patterns are valid:
);
```
### `allowEmpty: true`
If you want to allow dynamic imports without a webpackChunkName, you can set `allowEmpty: true` in the rule config. This will allow dynamic imports without a leading comment, or with a leading comment that does not contain a webpackChunkName.
Given `{ "allowEmpty": true }`:
<!-- markdownlint-disable-next-line MD024 -- duplicate header -->
### valid
The following patterns are valid:
```javascript
import('someModule');
import(
/* webpackChunkName: "someModule" */
'someModule',
);
```
<!-- markdownlint-disable-next-line MD024 -- duplicate header -->
### invalid
The following patterns are invalid:
```javascript
// incorrectly formatted comment
import(
/*webpackChunkName:"someModule"*/
'someModule',
);
```
## When Not To Use It
If you don't care that webpack will autogenerate chunk names and may blow up browser caches and bundle size reports.

View file

@ -1,6 +1,6 @@
# import/no-empty-named-blocks
🔧💡 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix) and manually fixable by [editor suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
🔧💡 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix) and manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions).
<!-- end auto-generated rule header -->

View file

@ -32,7 +32,7 @@ You can also use an array of globs instead of literal booleans:
"import/no-extraneous-dependencies": ["error", {"devDependencies": ["**/*.test.js", "**/*.spec.js"]}]
```
When using an array of globs, the setting will be set to `true` (no errors reported) if the name of the file being linted matches a single glob in the array, and `false` otherwise.
When using an array of globs, the setting will be set to `true` (no errors reported) if the name of the file being linted (i.e. not the imported file/module) matches a single glob in the array, and `false` otherwise.
There are 2 boolean options to opt into checking extra imports that are normally ignored: `includeInternal`, which enables the checking of internal modules, and `includeTypes`, which enables checking of type imports in TypeScript.

View file

@ -29,8 +29,9 @@ This rule takes the following option:
- **`missingExports`**: if `true`, files without any exports are reported (defaults to `false`)
- **`unusedExports`**: if `true`, exports without any static usage within other modules are reported (defaults to `false`)
- `src`: an array with files/paths to be analyzed. It only applies to unused exports. Defaults to `process.cwd()`, if not provided
- `ignoreExports`: an array with files/paths for which unused exports will not be reported (e.g module entry points in a published package)
- **`ignoreUnusedTypeExports`**: if `true`, TypeScript type exports without any static usage within other modules are reported (defaults to `false` and has no effect unless `unusedExports` is `true`)
- **`src`**: an array with files/paths to be analyzed. It only applies to unused exports. Defaults to `process.cwd()`, if not provided
- **`ignoreExports`**: an array with files/paths for which unused exports will not be reported (e.g module entry points in a published package)
### Example for missing exports
@ -116,6 +117,16 @@ export function doAnything() {
export default 5 // will not be reported
```
### Unused exports with `ignoreUnusedTypeExports` set to `true`
The following will not be reported:
```ts
export type Foo = {}; // will not be reported
export interface Foo = {}; // will not be reported
export enum Foo {}; // will not be reported
```
#### Important Note
Exports from files listed as a main file (`main`, `browser`, or `bin` fields in `package.json`) will be ignored by default. This only applies if the `package.json` is not set to `private: true`

View file

@ -77,6 +77,25 @@ import foo from './foo';
var path = require('path');
```
## Limitations of `--fix`
Unbound imports are assumed to have side effects, and will never be moved/reordered. This can cause other imports to get "stuck" around them, and the fix to fail.
```javascript
import b from 'b'
import 'format.css'; // This will prevent --fix from working.
import a from 'a'
```
As a workaround, move unbound imports to be entirely above or below bound ones.
```javascript
import 'format1.css'; // OK
import b from 'b'
import a from 'a'
import 'format2.css'; // OK
```
## Options
This rule supports the following options:
@ -174,7 +193,7 @@ Example:
### `pathGroupsExcludedImportTypes: [array]`
This defines import types that are not handled by configured pathGroups.
This is mostly needed when you want to handle path groups that look like external imports.
If you have added path groups with patterns that look like `"builtin"` or `"external"` imports, you have to remove this group (`"builtin"` and/or `"external"`) from the default exclusion list (e.g., `["builtin", "external", "object"]`, etc) to sort these path groups correctly.
Example:
@ -193,29 +212,7 @@ Example:
}
```
You can also use `patterns`(e.g., `react`, `react-router-dom`, etc).
Example:
```json
{
"import/order": [
"error",
{
"pathGroups": [
{
"pattern": "react",
"group": "builtin",
"position": "before"
}
],
"pathGroupsExcludedImportTypes": ["react"]
}
]
}
```
The default value is `["builtin", "external", "object"]`.
[Import Type](https://github.com/import-js/eslint-plugin-import/blob/HEAD/src/core/importType.js#L90) is resolved as a fixed string in predefined set, it can't be a `patterns`(e.g., `react`, `react-router-dom`, etc). See [#2156] for details.
### `newlines-between: [ignore|always|always-and-inside-groups|never]`

File diff suppressed because one or more lines are too long

49
node_modules/eslint-plugin-import/lib/core/fsWalk.js generated vendored Normal file
View file

@ -0,0 +1,49 @@
'use strict';Object.defineProperty(exports, "__esModule", { value: true });exports.
walkSync = walkSync;var _path = require('path');var _path2 = _interopRequireDefault(_path);var _fs = require('fs');function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} /** @typedef {{ name: string, path: string, dirent: import('fs').Dirent }} Entry */ /**
* Do a comprehensive walk of the provided src directory, and collect all entries. Filter out
* any directories or entries using the optional filter functions.
* @param {string} root - path to the root of the folder we're walking
* @param {{ deepFilter?: (entry: Entry) => boolean, entryFilter?: (entry: Entry) => boolean }} options
* @param {Entry} currentEntry - entry for the current directory we're working in
* @param {Entry[]} existingEntries - list of all entries so far
* @returns {Entry[]} an array of directory entries
*/ /**
* This is intended to provide similar capability as the sync api from @nodelib/fs.walk, until `eslint-plugin-import`
* is willing to modernize and update their minimum node version to at least v16. I intentionally made the
* shape of the API (for the part we're using) the same as @nodelib/fs.walk so that that can be swapped in
* when the repo is ready for it.
*/function walkSync(root, options, currentEntry, existingEntries) {// Extract the filter functions. Default to evaluating true, if no filter passed in.
var _options$deepFilter = options.deepFilter,deepFilter = _options$deepFilter === undefined ? function () {return true;} : _options$deepFilter,_options$entryFilter = options.entryFilter,entryFilter = _options$entryFilter === undefined ? function () {return true;} : _options$entryFilter;var entryList = existingEntries || [];var currentRelativePath = currentEntry ? currentEntry.path : '.';var fullPath = currentEntry ? _path2['default'].join(root, currentEntry.path) : root;var dirents = (0, _fs.readdirSync)(fullPath, { withFileTypes: true });dirents.forEach(function (dirent) {/** @type {Entry} */var entry = { name: dirent.name, path: _path2['default'].join(currentRelativePath, dirent.name), dirent: dirent };
if (dirent.isDirectory() && deepFilter(entry)) {
entryList.push(entry);
entryList = walkSync(root, options, entry, entryList);
} else if (dirent.isFile() && entryFilter(entry)) {
entryList.push(entry);
}
});
return entryList;
}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb3JlL2ZzV2Fsay5qcyJdLCJuYW1lcyI6WyJ3YWxrU3luYyIsInJvb3QiLCJvcHRpb25zIiwiY3VycmVudEVudHJ5IiwiZXhpc3RpbmdFbnRyaWVzIiwiZGVlcEZpbHRlciIsImVudHJ5RmlsdGVyIiwiZW50cnlMaXN0IiwiY3VycmVudFJlbGF0aXZlUGF0aCIsInBhdGgiLCJmdWxsUGF0aCIsImpvaW4iLCJkaXJlbnRzIiwid2l0aEZpbGVUeXBlcyIsImZvckVhY2giLCJkaXJlbnQiLCJlbnRyeSIsIm5hbWUiLCJpc0RpcmVjdG9yeSIsInB1c2giLCJpc0ZpbGUiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQXFCZ0JBLFEsR0F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W50RW50cnkucGF0aCA6ICcuJztcbiAgY29uc3QgZnVsbFBhdGggPSBjdXJyZW50RW50cnkgPyBwYXRoLmpvaW4ocm9vdCwgY3VycmVudEVudHJ5LnBhdGgpIDogcm9vdDtcblxuICBjb25zdCBkaXJlbnRzID0gcmVhZGRpclN5bmMoZnVsbFBhdGgsIHsgd2l0aEZpbGVUeXBlczogdHJ1ZSB9KTtcbiAgZGlyZW50cy5mb3JFYWNoKChkaXJlbnQpID0+IHtcbiAgICAvKiogQHR5cGUge0VudHJ5fSAqL1xuICAgIGNvbnN0IGVudHJ5ID0ge1xuICAgICAgbmFtZTogZGlyZW50Lm5hbWUsXG4gICAgICBwYXRoOiBwYXRoLmpvaW4oY3VycmVudFJlbGF0aXZlUGF0aCwgZGlyZW50Lm5hbWUpLFxuICAgICAgZGlyZW50LFxuICAgIH07XG5cbiAgICBpZiAoZGlyZW50LmlzRGlyZWN0b3J5KCkgJiYgZGVlcEZpbHRlcihlbnRyeSkpIHtcbiAgICAgIGVudHJ5TGlzdC5wdXNoKGVudHJ5KTtcbiAgICAgIGVudHJ5TGlzdCA9IHdhbGtTeW5jKHJvb3QsIG9wdGlvbnMsIGVudHJ5LCBlbnRyeUxpc3QpO1xuICAgIH0gZWxzZSBpZiAoZGlyZW50LmlzRmlsZSgpICYmIGVudHJ5RmlsdGVyKGVudHJ5KSkge1xuICAgICAgZW50cnlMaXN0LnB1c2goZW50cnkpO1xuICAgIH1cbiAgfSk7XG5cbiAgcmV0dXJuIGVudHJ5TGlzdDtcbn1cbiJdfQ==

File diff suppressed because one or more lines are too long

View file

@ -2,16 +2,16 @@
getContextPackagePath = getContextPackagePath;exports.
getFilePackagePath = getFilePackagePath;exports.
getFilePackageName = getFilePackageName;var _path = require('path');var _pkgUp = require('eslint-module-utils/pkgUp');var _pkgUp2 = _interopRequireDefault(_pkgUp);var _readPkgUp2 = require('eslint-module-utils/readPkgUp');var _readPkgUp3 = _interopRequireDefault(_readPkgUp2);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}function getContextPackagePath(context) {return getFilePackagePath(context.getPhysicalFilename ? context.getPhysicalFilename() : context.getFilename());}function getFilePackagePath(filePath) {var fp = (0, _pkgUp2['default'])({ cwd: filePath });return (0, _path.dirname)(fp);}function getFilePackageName(filePath) {var _readPkgUp =
getContextPackagePath = getContextPackagePath;exports.
getFilePackageName = getFilePackageName;var _path = require('path');var _pkgUp = require('eslint-module-utils/pkgUp');var _pkgUp2 = _interopRequireDefault(_pkgUp);var _readPkgUp2 = require('eslint-module-utils/readPkgUp');var _readPkgUp3 = _interopRequireDefault(_readPkgUp2);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}function getFilePackagePath(filePath) {var fp = (0, _pkgUp2['default'])({ cwd: filePath });return (0, _path.dirname)(fp);}function getContextPackagePath(context) {return getFilePackagePath(context.getPhysicalFilename ? context.getPhysicalFilename() : context.getFilename());}function getFilePackageName(filePath) {var _readPkgUp =
(0, _readPkgUp3['default'])({ cwd: filePath, normalize: false }),pkg = _readPkgUp.pkg,path = _readPkgUp.path;
if (pkg) {
// recursion in case of intermediate esm package.json without name found
@ -19,4 +19,4 @@ getFilePackageName = getFilePackageName;var _path = require('path');var _pkgUp =
}
return null;
}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb3JlL3BhY2thZ2VQYXRoLmpzIl0sIm5hbWVzIjpbImdldENvbnRleHRQYWNrYWdlUGF0aCIsImdldEZpbGVQYWNrYWdlUGF0aCIsImdldEZpbGVQYWNrYWdlTmFtZSIsImNvbnRleHQiLCJnZXRQaHlzaWNhbEZpbGVuYW1lIiwiZ2V0RmlsZW5hbWUiLCJmaWxlUGF0aCIsImZwIiwiY3dkIiwibm9ybWFsaXplIiwicGtnIiwicGF0aCIsIm5hbWUiXSwibWFwcGluZ3MiOiI7Ozs7QUFJZ0JBLHFCLEdBQUFBLHFCOz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tdXRpbHMvcmVhZFBrZ1VwJztcblxuZXhwb3J0IGZ1bmN0aW9uIGdldEZpbGVQYWNrYWdlUGF0aChmaWxlUGF0aCkge1xuICBjb25zdCBmcCA9IHBrZ1VwKHsgY3dkOiBmaWxlUGF0aCB9KTtcbiAgcmV0dXJuIGRpcm5hbWUoZnApO1xufVxuXG5leHBvcnQgZnVuY3Rpb24gZ2V0Q29udGV4dFBhY2thZ2VQYXRoKGNvbnRleHQpIHtcbiAgcmV0dXJuIGdldEZpbGVQYWNrYWdlUGF0aChjb250ZXh0LmdldFBoeXNpY2FsRmlsZW5hbWUgPyBjb250ZXh0LmdldFBoeXNpY2FsRmlsZW5hbWUoKSA6IGNvbnRleHQuZ2V0RmlsZW5hbWUoKSk7XG59XG5cbmV4cG9ydCBmdW5jdGlvbiBnZXRGaWxlUGFja2FnZU5hbWUoZmlsZVBhdGgpIHtcbiAgY29uc3QgeyBwa2csIHBhdGggfSA9IHJlYWRQa2dVcCh7IGN3ZDogZmlsZVBhdGgsIG5vcm1hbGl6ZTogZmFsc2UgfSk7XG4gIGlmIChwa2cpIHtcbiAgICAvLyByZWN1cnNpb24gaW4gY2FzZSBvZiBpbnRlcm1lZGlhdGUgZXNtIHBhY2thZ2UuanNvbiB3aXRob3V0IG5hbWUgZm91bmRcbiAgICByZXR1cm4gcGtnLm5hbWUgfHwgZ2V0RmlsZVBhY2thZ2VOYW1lKGRpcm5hbWUoZGlybmFtZShwYXRoKSkpO1xuICB9XG4gIHJldHVybiBudWxsO1xufVxuIl19

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,33 @@
'use strict';Object.defineProperty(exports, "__esModule", { value: true });exports['default'] =
childContext;var _hash = require('eslint-module-utils/hash');var parserOptionsHash = '';var prevParserOptions = '';var settingsHash = '';var prevSettings = ''; /**
* don't hold full context object in memory, just grab what we need.
* also calculate a cacheKey, where parts of the cacheKey hash are memoized
*/function childContext(path, context) {var settings = context.settings,parserOptions = context.parserOptions,parserPath = context.parserPath;if (JSON.stringify(settings) !== prevSettings) {
settingsHash = (0, _hash.hashObject)({ settings: settings }).digest('hex');
prevSettings = JSON.stringify(settings);
}
if (JSON.stringify(parserOptions) !== prevParserOptions) {
parserOptionsHash = (0, _hash.hashObject)({ parserOptions: parserOptions }).digest('hex');
prevParserOptions = JSON.stringify(parserOptions);
}
return {
cacheKey: String(parserPath) + parserOptionsHash + settingsHash + String(path),
settings: settings,
parserOptions: parserOptions,
parserPath: parserPath,
path: path };
}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9leHBvcnRNYXAvY2hpbGRDb250ZXh0LmpzIl0sIm5hbWVzIjpbImNoaWxkQ29udGV4dCIsInBhcnNlck9wdGlvbnNIYXNoIiwicHJldlBhcnNlck9wdGlvbnMiLCJzZXR0aW5nc0hhc2giLCJwcmV2U2V0dGluZ3MiLCJwYXRoIiwiY29udGV4dCIsInNldHRpbmdzIiwicGFyc2VyT3B0aW9ucyIsInBhcnNlclBhdGgiLCJKU09OIiwic3RyaW5naWZ5IiwiZGlnZXN0IiwiY2FjaGVLZXkiLCJTdHJpbmciXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7O0FBV3dCQSxZLENBWHhCLGdEQUVBLElBQUlDLG9CQUFvQixFQUF4QixDQUNBLElBQUlDLG9CQUFvQixFQUF4QixDQUNBLElBQUlDLGVBQWUsRUFBbkIsQ0FDQSxJQUFJQyxlQUFlLEVBQW5CLEMsQ0FFQTs7O21LQUllLFNBQVNKLFlBQVQsQ0FBc0JLLElBQXRCLEVBQTRCQyxPQUE1QixFQUFxQyxLQUMxQ0MsUUFEMEMsR0FDRkQsT0FERSxDQUMxQ0MsUUFEMEMsQ0FDaENDLGFBRGdDLEdBQ0ZGLE9BREUsQ0FDaENFLGFBRGdDLENBQ2pCQyxVQURpQixHQUNGSCxPQURFLENBQ2pCRyxVQURpQixDQUdsRCxJQU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ZSBwYXJ0cyBvZiB0aGUgY2FjaGVLZXkgaGFzaCBhcmUgbWVtb2l6ZWRcbiAqL1xuZXhwb3J0IGRlZmF1bHQgZnVuY3Rpb24gY2hpbGRDb250ZXh0KHBhdGgsIGNvbnRleHQpIHtcbiAgY29uc3QgeyBzZXR0aW5ncywgcGFyc2VyT3B0aW9ucywgcGFyc2VyUGF0aCB9ID0gY29udGV4dDtcblxuICBpZiAoSlNPTi5zdHJpbmdpZnkoc2V0dGluZ3MpICE9PSBwcmV2U2V0dGluZ3MpIHtcbiAgICBzZXR0aW5nc0hhc2ggPSBoYXNoT2JqZWN0KHsgc2V0dGluZ3MgfSkuZGlnZXN0KCdoZXgnKTtcbiAgICBwcmV2U2V0dGluZ3MgPSBKU09OLnN0cmluZ2lmeShzZXR0aW5ncyk7XG4gIH1cblxuICBpZiAoSlNPTi5zdHJpbmdpZnkocGFyc2VyT3B0aW9ucykgIT09IHByZXZQYXJzZXJPcHRpb25zKSB7XG4gICAgcGFyc2VyT3B0aW9uc0hhc2ggPSBoYXNoT2JqZWN0KHsgcGFyc2VyT3B0aW9ucyB9KS5kaWdlc3QoJ2hleCcpO1xuICAgIHByZXZQYXJzZXJPcHRpb25zID0gSlNPTi5zdHJpbmdpZnkocGFyc2VyT3B0aW9ucyk7XG4gIH1cblxuICByZXR1cm4ge1xuICAgIGNhY2hlS2V5OiBTdHJpbmcocGFyc2VyUGF0aCkgKyBwYXJzZXJPcHRpb25zSGFzaCArIHNldHRpbmdzSGFzaCArIFN0cmluZyhwYXRoKSxcbiAgICBzZXR0aW5ncyxcbiAgICBwYXJzZXJPcHRpb25zLFxuICAgIHBhcnNlclBhdGgsXG4gICAgcGF0aCxcbiAgfTtcbn1cbiJdfQ==

90
node_modules/eslint-plugin-import/lib/exportMap/doc.js generated vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,39 @@
'use strict';Object.defineProperty(exports, "__esModule", { value: true });var _createClass = function () {function defineProperties(target, props) {for (var i = 0; i < props.length; i++) {var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);}}return function (Constructor, protoProps, staticProps) {if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;};}();var _childContext = require('./childContext');var _childContext2 = _interopRequireDefault(_childContext);
var _remotePath = require('./remotePath');function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a function");}}var
Namespace = function () {
function Namespace(
path,
context,
ExportMapBuilder)
{_classCallCheck(this, Namespace);
this.remotePathResolver = new _remotePath.RemotePath(path, context);
this.context = context;
this.ExportMapBuilder = ExportMapBuilder;
this.namespaces = new Map();
}_createClass(Namespace, [{ key: 'resolveImport', value: function () {function resolveImport(
value) {
var rp = this.remotePathResolver.resolve(value);
if (rp == null) {return null;}
return this.ExportMapBuilder['for']((0, _childContext2['default'])(rp, this.context));
}return resolveImport;}() }, { key: 'getNamespace', value: function () {function getNamespace(
identifier) {var _this = this;
if (!this.namespaces.has(identifier.name)) {return;}
return function () {return _this.resolveImport(_this.namespaces.get(identifier.name));};
}return getNamespace;}() }, { key: 'add', value: function () {function add(
object, identifier) {
var nsfn = this.getNamespace(identifier);
if (nsfn) {
Object.defineProperty(object, 'namespace', { get: nsfn });
}
return object;
}return add;}() }, { key: 'rawSet', value: function () {function rawSet(
name, value) {
this.namespaces.set(name, value);
}return rawSet;}() }]);return Namespace;}();exports['default'] = Namespace;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9leHBvcnRNYXAvbmFtZXNwYWNlLmpzIl0sIm5hbWVzIjpbIk5hbWVzcGFjZSIsInBhdGgiLCJjb250ZXh0IiwiRXhwb3J0T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nN0IHJwID0gdGhpcy5yZW1vdGVQYXRoUmVzb2x2ZXIucmVzb2x2ZSh2YWx1ZSk7XG4gICAgaWYgKHJwID09IG51bGwpIHsgcmV0dXJuIG51bGw7IH1cbiAgICByZXR1cm4gdGhpcy5FeHBvcnRNYXBCdWlsZGVyLmZvcihjaGlsZENvbnRleHQocnAsIHRoaXMuY29udGV4dCkpO1xuICB9XG5cbiAgZ2V0TmFtZXNwYWNlKGlkZW50aWZpZXIpIHtcbiAgICBpZiAoIXRoaXMubmFtZXNwYWNlcy5oYXMoaWRlbnRpZmllci5uYW1lKSkgeyByZXR1cm47IH1cbiAgICByZXR1cm4gKCkgPT4gdGhpcy5yZXNvbHZlSW1wb3J0KHRoaXMubmFtZXNwYWNlcy5nZXQoaWRlbnRpZmllci5uYW1lKSk7XG4gIH1cblxuICBhZGQob2JqZWN0LCBpZGVudGlmaWVyKSB7XG4gICAgY29uc3QgbnNmbiA9IHRoaXMuZ2V0TmFtZXNwYWNlKGlkZW50aWZpZXIpO1xuICAgIGlmIChuc2ZuKSB7XG4gICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkob2JqZWN0LCAnbmFtZXNwYWNlJywgeyBnZXQ6IG5zZm4gfSk7XG4gICAgfVxuXG4gICAgcmV0dXJuIG9iamVjdDtcbiAgfVxuXG4gIHJhd1NldChuYW1lLCB2YWx1ZSkge1xuICAgIHRoaXMubmFtZXNwYWNlcy5zZXQobmFtZSwgdmFsdWUpO1xuICB9XG59XG4iXX0=

View file

@ -0,0 +1,41 @@
'use strict';Object.defineProperty(exports, "__esModule", { value: true });exports['default'] =
recursivePatternCapture; /**
* Traverse a pattern/identifier node, calling 'callback'
* for each leaf identifier.
* @param {node} pattern
* @param {Function} callback
* @return {void}
*/function recursivePatternCapture(pattern, callback) {switch (pattern.type) {case 'Identifier': // base case
callback(pattern);break;case 'ObjectPattern':pattern.properties.forEach(function (p) {
if (p.type === 'ExperimentalRestProperty' || p.type === 'RestElement') {
callback(p.argument);
return;
}
recursivePatternCapture(p.value, callback);
});
break;
case 'ArrayPattern':
pattern.elements.forEach(function (element) {
if (element == null) {return;}
if (element.type === 'ExperimentalRestProperty' || element.type === 'RestElement') {
callback(element.argument);
return;
}
recursivePatternCapture(element, callback);
});
break;
case 'AssignmentPattern':
callback(pattern.left);
break;
default:}
}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9leHBvcnRNYXAvcGF0dGVybkNhcHR1cmUuanMiXSwibmFtZXMiOlsicmVjdXJzaXZlUGF0dGVybkNhcHR1cmUiLCJwYXR0ZXJuIiwiY2FsbGJhY2siLCJ0eXBlIiwicHJvcGVydGllcyIsImZvckVhY2giLCJwIiwiYXJndW1lbnQiLCJ2YWx1ZSIsImVsZW1lbnRzIiwiZWxlbWVudCIsImxlZnQiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFPd0JBLHVCLEVBUHhCOzs7Ozs7NEJBT2UsU0FBU0EsdUJBQVQsQ0FBaUNDLE9BQWpDLEVBQTBDQyxRQUExQyxFQUFvRCxDQUNqRSxRQUFRRCxRQUFRRSxJQUFoQixHQUNFLEtBQUssWUFBTCxFQUFtQjtBQUNqQkQsZUFBU0QsT0FBVCxFQUNBLE1BRUYsS0FBSyxlQUFMLENBQ0VBLFFBQVFHLFVBQVIsQ0FBbUJDLE9BQW5CLENBQTJCLFVBQUNDLENBQUQsRUFBTztBQUNoQyxZQUFJQSxFQUFFSCxJQUFGLEtBQVcsMEJBQVgsSUFBeUNHLEVBQUVILElBQUYsS0FBVyxhQUF4RCxFQUF1RTtBQUNyRUQsbUJBQVNJLEVBQUVDLFFBQVg7QUFDQTtBQUNEO0FBQ0RQLGdDQUF3Qk0sRUFBRUUsS0FBMUIsRUFBaUNOLFFBQWpDO0FBQ0QsT0FORDtBQU9BOztBQUVGLFNBQUssY0FBTDtBQUNFRCxjQUFRUSxRQUFSLENBQWlCSixPQUFqQixDQUF5Q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BlID09PSAnUmVzdEVsZW1lbnQnKSB7XG4gICAgICAgICAgY2FsbGJhY2socC5hcmd1bWVudCk7XG4gICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG4gICAgICAgIHJlY3Vyc2l2ZVBhdHRlcm5DYXB0dXJlKHAudmFsdWUsIGNhbGxiYWNrKTtcbiAgICAgIH0pO1xuICAgICAgYnJlYWs7XG5cbiAgICBjYXNlICdBcnJheVBhdHRlcm4nOlxuICAgICAgcGF0dGVybi5lbGVtZW50cy5mb3JFYWNoKChlbGVtZW50KSA9PiB7XG4gICAgICAgIGlmIChlbGVtZW50ID09IG51bGwpIHsgcmV0dXJuOyB9XG4gICAgICAgIGlmIChlbGVtZW50LnR5cGUgPT09ICdFeHBlcmltZW50YWxSZXN0UHJvcGVydHknIHx8IGVsZW1lbnQudHlwZSA9PT0gJ1Jlc3RFbGVtZW50Jykge1xuICAgICAgICAgIGNhbGxiYWNrKGVsZW1lbnQuYXJndW1lbnQpO1xuICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgICAgICByZWN1cnNpdmVQYXR0ZXJuQ2FwdHVyZShlbGVtZW50LCBjYWxsYmFjayk7XG4gICAgICB9KTtcbiAgICAgIGJyZWFrO1xuXG4gICAgY2FzZSAnQXNzaWdubWVudFBhdHRlcm4nOlxuICAgICAgY2FsbGJhY2socGF0dGVybi5sZWZ0KTtcbiAgICAgIGJyZWFrO1xuICAgIGRlZmF1bHQ6XG4gIH1cbn1cbiJdfQ==

Some files were not shown because too many files have changed in this diff Show more