Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support eslint ^9.0.0 #114

Open
3 tasks done
iterox opened this issue Aug 8, 2024 · 4 comments
Open
3 tasks done

feat: support eslint ^9.0.0 #114

iterox opened this issue Aug 8, 2024 · 4 comments

Comments

@iterox
Copy link

iterox commented Aug 8, 2024

Prerequisites

Describe the Feature Request

As per April 5, 2024 eslint v9.0.0 has been released. As of July 26, 2024 eslint v9.8.0 has been released. This plugin does not support eslint v9.0.0. This prevents projects using @stencil-community/eslint-plugin from upgrading eslint to the latest version.

Among others see ESLint v9.0.0 released and Migrate to v9.x for more details on the changes (some of which impact plugins).

Describe the Use Case

I want to be able to keep up-to-date dependencies.

Describe Preferred Solution

No response

Describe Alternatives

No response

Related Code

No response

Additional Information

No response

@Tallyb
Copy link

Tallyb commented Aug 9, 2024

here is a the patch package code for 0.8.0

diff --git a/node_modules/@stencil-community/eslint-plugin/dist/index.js b/node_modules/@stencil-community/eslint-plugin/dist/index.js
index eaca0cf..2176da1 100644
--- a/node_modules/@stencil-community/eslint-plugin/dist/index.js
+++ b/node_modules/@stencil-community/eslint-plugin/dist/index.js
@@ -189,7 +189,7 @@ const rule$o = {
     },
     create(context) {
         const stencil = stencilComponentContext();
-        const parserServices = context.parserServices;
+        const parserServices = context.parserServices || context.sourceCode.parserServices;
         const typeChecker = parserServices.program.getTypeChecker();
         return Object.assign(Object.assign({}, stencil.rules), { 'MethodDefinition > Decorator[expression.callee.name=Method]': (decoratorNode) => {
                 if (!stencil.isComponent()) {
@@ -322,7 +322,7 @@ const rule$l = {
     },
     create(context) {
         const stencil = stencilComponentContext();
-        const parserServices = context.parserServices;
+        const parserServices = context.parserServices || context.sourceCode.parserServices;
         return Object.assign(Object.assign({}, stencil.rules), { 'ClassDeclaration': (node) => {
                 const component = getDecorator(node, 'Component');
                 const options = context.options[0];
@@ -455,7 +455,7 @@ const rule$j = {
     },
     create(context) {
         const stencil = stencilComponentContext();
-        const parserServices = context.parserServices;
+        const parserServices = context.parserServices || context.sourceCode.parserServices;
         const opts = context.options[0] || {};
         const options = Object.assign(Object.assign({}, DEFAULTS$1), opts);
         function checkStyle(decorator) {
@@ -576,7 +576,7 @@ const rule$g = {
     },
     create(context) {
         const stencil = stencilComponentContext();
-        const parserServices = context.parserServices;
+        const parserServices = context.parserServices || context.sourceCode.parserServices;
         return Object.assign(Object.assign({}, stencil.rules), { 'MethodDefinition[kind=method]': (node) => {
                 if (stencil.isComponent() && getDecorator(node, 'Method')) {
                     const originalNode = parserServices.esTreeNodeToTSNodeMap.get(node);
@@ -604,7 +604,7 @@ const rule$f = {
     },
     create(context) {
         const stencil = stencilComponentContext();
-        const parserServices = context.parserServices;
+        const parserServices = context.parserServices || context.sourceCode.parserServices;
         function getVars(node) {
             if (!stencil.isComponent()) {
                 return;
@@ -696,7 +696,7 @@ const rule$e = {
     },
     create(context) {
         const stencil = stencilComponentContext();
-        const parserServices = context.parserServices;
+        const parserServices = context.parserServices || context.sourceCode.parserServices;
         return Object.assign(Object.assign({}, stencil.rules), { "MethodDefinition[kind=method]": (node) => {
                 if (!stencil.isComponent()) {
                     return;
@@ -740,7 +740,7 @@ const rule$d = {
     },
     create(context) {
         const stencil = stencilComponentContext();
-        const parserServices = context.parserServices;
+        const parserServices = context.parserServices || context.sourceCode.parserServices;
         return Object.assign(Object.assign({}, stencil.rules), { PropertyDefinition: (node) => {
                 if (!stencil.isComponent()) {
                     return;
@@ -830,7 +830,7 @@ const rule$b = {
     },
     create(context) {
         const stencil = stencilComponentContext();
-        const parserServices = context.parserServices;
+        const parserServices = context.parserServices || context.sourceCode.parserServices;
         return Object.assign(Object.assign({}, stencil.rules), { 'PropertyDefinition': (node) => {
                 if (stencil.isComponent() && getDecorator(node, 'Prop')) {
                     const originalNode = parserServices.esTreeNodeToTSNodeMap.get(node);
@@ -858,7 +858,7 @@ const rule$a = {
     },
     create(context) {
         const stencil = stencilComponentContext();
-        const parserServices = context.parserServices;
+        const parserServices = context.parserServices || context.sourceCode.parserServices;
         return Object.assign(Object.assign({}, stencil.rules), { 'PropertyDefinition': (node) => {
                 var _a;
                 const propDecorator = getDecorator(node, 'Prop');
@@ -903,7 +903,7 @@ const rule$9 = {
         // Public
         //----------------------------------------------------------------------
         const stencil = stencilComponentContext();
-        const parserServices = context.parserServices;
+        const parserServices = context.parserServices || context.sourceCode.parserServices;
         const typeChecker = parserServices.program.getTypeChecker();
         return Object.assign(Object.assign({}, stencil.rules), { 'MethodDefinition[kind=method][key.name=render] ReturnStatement': (node) => {
                 if (!stencil.isComponent()) {
@@ -935,7 +935,7 @@ const rule$8 = {
     },
     create(context) {
         const stencil = stencilComponentContext();
-        const parserServices = context.parserServices;
+        const parserServices = context.parserServices || context.sourceCode.parserServices;
         function getJSDoc(node) {
             if (!stencil.isComponent()) {
                 return;
@@ -1119,7 +1119,7 @@ const rule$5 = {
         type: 'problem'
     },
     create(context) {
-        const parserServices = context.parserServices;
+        const parserServices = context.parserServices || context.sourceCode.parserServices;
         const typeChecker = parserServices.program.getTypeChecker();
         return {
             'ClassDeclaration': (node) => {
@@ -1312,7 +1312,7 @@ const rule$2 = {
         type: 'problem'
     },
     create(context) {
-        const parserServices = context.parserServices;
+        const parserServices = context.parserServices || context.sourceCode.parserServices;
         const program = parserServices.program;
         const rawOptions = context.options[0] || ['allow-null-union', 'allow-undefined-union', 'allow-boolean-or-undefined'];
         const options = parseOptions(rawOptions, true);

@iterox
Copy link
Author

iterox commented Aug 12, 2024

Thanks @Tallyb for the patch.

Please could you remove line 11?

+        console.dir(parserServices)

@Tallyb
Copy link

Tallyb commented Aug 12, 2024

udpated

@iterox
Copy link
Author

iterox commented Aug 13, 2024

Thank you very much @Tallyb, now we have a working flat config eslint v9, @typescript-eslint v8 with @stencil-community/eslint-plugin v0.8.0 incl. the patch you provided 👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants