eslint-plugin-absolute 0.11.2 → 0.11.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/LICENSE +17 -19
  2. package/dist/index.js +75 -0
  3. package/package.json +4 -3
package/LICENSE CHANGED
@@ -1,23 +1,21 @@
1
- ```
2
- # Creative Commons Attribution-NonCommercial 4.0 International License (CC BY-NC 4.0)
1
+ MIT License
3
2
 
4
- By using this project, you agree to the following terms under the Creative Commons Attribution-NonCommercial 4.0 International License.
3
+ Copyright (c) 2026 Alex Kahn
5
4
 
6
- ## License Summary
7
- This license allows you to:
8
- - **Share**: Copy and redistribute the material in any medium or format.
9
- - **Adapt**: Remix, transform, and build upon the material.
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
10
11
 
11
- **Under the following conditions**:
12
- - **Attribution**: You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
13
- - **Non-Commercial**: You may not use the material for commercial purposes.
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
14
 
15
- ## Full License Text
16
- The full license text can be found at: https://creativecommons.org/licenses/by-nc/4.0/legalcode
17
-
18
- ## Contact Information for Commercial Use
19
- For commercial use, licensing inquiries, or additional permissions, please contact:
20
- Alex Kahn
21
- alexkahndev@gmail.com
22
- alexkahndev.github.io
23
- ```
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.js CHANGED
@@ -2871,6 +2871,80 @@ var noMultiStyleObjects = createRule({
2871
2871
  name: "no-multi-style-objects"
2872
2872
  });
2873
2873
 
2874
+ // src/rules/no-useless-catch.ts
2875
+ var unwrapExpression = (expression) => {
2876
+ switch (expression.type) {
2877
+ case "ChainExpression":
2878
+ return unwrapExpression(expression.expression);
2879
+ case "TSAsExpression":
2880
+ case "TSNonNullExpression":
2881
+ case "TSSatisfiesExpression":
2882
+ case "TSTypeAssertion":
2883
+ return unwrapExpression(expression.expression);
2884
+ default:
2885
+ return expression;
2886
+ }
2887
+ };
2888
+ var hasSideEffect = (expression) => {
2889
+ const unwrapped = unwrapExpression(expression);
2890
+ switch (unwrapped.type) {
2891
+ case "AssignmentExpression":
2892
+ case "AwaitExpression":
2893
+ case "CallExpression":
2894
+ case "ImportExpression":
2895
+ case "NewExpression":
2896
+ case "UpdateExpression":
2897
+ case "YieldExpression":
2898
+ return true;
2899
+ case "UnaryExpression":
2900
+ return unwrapped.operator === "delete";
2901
+ case "ConditionalExpression":
2902
+ return hasSideEffect(unwrapped.consequent) || hasSideEffect(unwrapped.alternate);
2903
+ case "LogicalExpression":
2904
+ return hasSideEffect(unwrapped.left) || hasSideEffect(unwrapped.right);
2905
+ case "SequenceExpression":
2906
+ return unwrapped.expressions.some(hasSideEffect);
2907
+ default:
2908
+ return false;
2909
+ }
2910
+ };
2911
+ var statementDoesWork = (statement) => {
2912
+ if (statement.type === "EmptyStatement") {
2913
+ return false;
2914
+ }
2915
+ if (statement.type === "ExpressionStatement") {
2916
+ return hasSideEffect(statement.expression);
2917
+ }
2918
+ return true;
2919
+ };
2920
+ var noUselessCatch = createRule({
2921
+ create(context) {
2922
+ return {
2923
+ CatchClause(node) {
2924
+ if (node.body.body.some(statementDoesWork)) {
2925
+ return;
2926
+ }
2927
+ context.report({
2928
+ messageId: "uselessCatch",
2929
+ node: node.body
2930
+ });
2931
+ }
2932
+ };
2933
+ },
2934
+ defaultOptions: [],
2935
+ meta: {
2936
+ docs: {
2937
+ description: "Disallow catch blocks that contain only comments or no-op statements. A catch block should handle, propagate, or record the error."
2938
+ },
2939
+ messages: {
2940
+ uselessCatch: "This catch block does not do any work. Handle, log, return, or rethrow the error instead of leaving a comment or no-op."
2941
+ },
2942
+ schema: [],
2943
+ type: "problem"
2944
+ },
2945
+ name: "no-useless-catch"
2946
+ });
2947
+
2874
2948
  // src/rules/no-useless-function.ts
2875
2949
  var noUselessFunction = createRule({
2876
2950
  create(context) {
@@ -4103,6 +4177,7 @@ var src_default = {
4103
4177
  "no-trivial-alias": noTrivialAlias,
4104
4178
  "no-unnecessary-div": noUnnecessaryDiv,
4105
4179
  "no-unnecessary-key": noUnnecessaryKey,
4180
+ "no-useless-catch": noUselessCatch,
4106
4181
  "no-useless-function": noUselessFunction,
4107
4182
  "prefer-inline-exports": preferInlineExports,
4108
4183
  "seperate-style-files": seperateStyleFiles,
package/package.json CHANGED
@@ -18,7 +18,7 @@
18
18
  "LICENSE",
19
19
  "README.md"
20
20
  ],
21
- "license": "CC BY-NC 4.0",
21
+ "license": "MIT",
22
22
  "main": "./dist/index.js",
23
23
  "name": "eslint-plugin-absolute",
24
24
  "peerDependencies": {
@@ -32,13 +32,14 @@
32
32
  },
33
33
  "scripts": {
34
34
  "build": "rm -rf dist && bun build src/index.ts --outdir dist --splitting --target=bun --external eslint --external @typescript-eslint/utils --external typescript",
35
+ "config": "absolute config",
35
36
  "format": "absolutejs prettier --write",
36
- "lint": "bun run build && bun run absolutejs eslint",
37
37
  "knip": "knip",
38
+ "lint": "bun run build && bun run absolutejs eslint",
38
39
  "release": "bun run format && bun run build && bun publish",
39
40
  "test": "bun test tests/",
40
41
  "typecheck": "bun run tsc --noEmit"
41
42
  },
42
43
  "type": "module",
43
- "version": "0.11.2"
44
+ "version": "0.11.4"
44
45
  }