eslint-plugin-qwik 0.0.18 → 0.0.20-5

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.
@@ -0,0 +1 @@
1
+ var a=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var u=(t,e)=>{for(var o in e)a(t,o,{get:e[o],enumerable:!0})},p=(t,e,o,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of l(e))!c.call(t,s)&&s!==o&&a(t,s,{get:()=>e[s],enumerable:!(r=i(e,s))||r.enumerable});return t};var m=t=>p(a({},"__esModule",{value:!0}),t);var d={};u(d,{configs:()=>f,rules:()=>w});module.exports=m(d);var n={meta:{type:"problem",docs:{description:"Object destructuring is not recomended for component$",category:"Variables",recommended:!0,url:"https://github.com/BuilderIO/qwik"}},create(t){let e=[];return{ArrowFunctionExpression(){e.push({await:!1})},"ArrowFunctionExpression:exit"(){e.pop()},AwaitExpression(){let o=e[e.length-1];o&&(o.await=!0)},"CallExpression[callee.name=/^use/]"(o){let r=e[e.length-1];r&&r.await&&t.report({node:o,message:"Calling use* methods after await is not safe."})}}}};var w={"no-use-after-await":n},f={recommended:{plugins:["qwik"],rules:{"qwik/no-use-after-await":"error"}}};0&&(module.exports={configs,rules});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-qwik",
3
- "version": "0.0.18",
3
+ "version": "0.0.20-5",
4
4
  "description": "An Open-Source sub-framework designed with a focus on server-side-rendering, lazy-loading, and styling/animation.",
5
5
  "main": "index.js",
6
6
  "author": "",
@@ -11,7 +11,8 @@
11
11
  "homepage": "https://github.com/BuilderIO/qwik#readme",
12
12
  "repository": {
13
13
  "type": "git",
14
- "url": "https://github.com/BuilderIO/qwik.git"
14
+ "url": "https://github.com/BuilderIO/qwik.git",
15
+ "directory": "packages/eslint-rules"
15
16
  },
16
17
  "bugs": {
17
18
  "url": "https://github.com/BuilderIO/qwik/issues"
package/index.js DELETED
@@ -1,15 +0,0 @@
1
- "use strict";
2
- exports.__esModule = true;
3
- exports.configs = exports.rules = void 0;
4
- var noUseAfterAwait_1 = require("./lib/noUseAfterAwait");
5
- exports.rules = {
6
- 'no-use-after-await': noUseAfterAwait_1.noUseAfterAwait
7
- };
8
- exports.configs = {
9
- recommended: {
10
- plugins: ['qwik'],
11
- rules: {
12
- 'qwik/no-use-after-await': 'error'
13
- }
14
- }
15
- };
@@ -1,48 +0,0 @@
1
- "use strict";
2
- /* eslint-disable no-console */
3
- /**
4
- * @license
5
- * Copyright Builder.io, Inc. All Rights Reserved.
6
- *
7
- * Use of this source code is governed by an MIT-style license that can be
8
- * found in the LICENSE file at https://github.com/BuilderIO/qwik/blob/main/LICENSE
9
- */
10
- exports.__esModule = true;
11
- exports.noUseAfterAwait = void 0;
12
- exports.noUseAfterAwait = {
13
- meta: {
14
- type: 'problem',
15
- docs: {
16
- description: 'Object destructuring is not recomended for component$',
17
- category: 'Variables',
18
- recommended: true,
19
- url: 'https://github.com/BuilderIO/qwik'
20
- }
21
- },
22
- create: function (context) {
23
- var stack = [];
24
- return {
25
- ArrowFunctionExpression: function () {
26
- stack.push({ await: false });
27
- },
28
- 'ArrowFunctionExpression:exit': function () {
29
- stack.pop();
30
- },
31
- AwaitExpression: function () {
32
- var last = stack[stack.length - 1];
33
- if (last) {
34
- last.await = true;
35
- }
36
- },
37
- 'CallExpression[callee.name=/^use/]': function (node) {
38
- var last = stack[stack.length - 1];
39
- if (last && last.await) {
40
- context.report({
41
- node: node,
42
- message: 'Calling use* methods after await is not safe.'
43
- });
44
- }
45
- }
46
- };
47
- }
48
- };
package/qwik.unit.js DELETED
@@ -1,37 +0,0 @@
1
- "use strict";
2
- exports.__esModule = true;
3
- /* eslint-disable */
4
- // @ts-ignore
5
- var RuleTester = require('eslint').RuleTester;
6
- var index_1 = require("./index");
7
- var testConfig = {
8
- env: {
9
- es6: true
10
- },
11
- parserOptions: {
12
- ecmaFeatures: {
13
- jsx: true
14
- },
15
- ecmaVersion: 2021,
16
- sourceType: 'module'
17
- }
18
- };
19
- describe('no-use-after-await', function () {
20
- var ruleTester = new RuleTester(testConfig);
21
- ruleTester.run('my-rule', index_1.rules['no-use-after-await'], {
22
- valid: [
23
- "export const HelloWorld = component$(async () => {\n useMethod();\n await something();\n return $(() => {\n return <Host></Host>\n });\n });",
24
- "export const HelloWorld = component$(async () => {\n useMethod();\n await something();\n await stuff();\n return $(() => {\n useHostElement();\n return <Host></Host>\n });\n });",
25
- ],
26
- invalid: [
27
- {
28
- code: "export const HelloWorld = component$(async () => {\n await something();\n useMethod();\n return $(() => {\n return (\n <Host>\n {prop}\n </Host>\n );\n });\n });",
29
- errors: ['Calling use* methods after await is not safe.']
30
- },
31
- {
32
- code: "export const HelloWorld = component$(async () => {\n if (stuff) {\n await something();\n }\n useMethod();\n return $(() => {\n return (\n <Host>\n {prop}\n </Host>\n );\n });\n });",
33
- errors: ['Calling use* methods after await is not safe.']
34
- },
35
- ]
36
- });
37
- });