Validation error if Import is not present in xtext - dsl

In my xtext grammar file to support wildcard import support, i have the following grammar rule.
Import:
'import' importedNamespace= QualifiedNameWithWildcard ';'
My requirement is i need to display the validation error if required dependency is not imported. for that i have added following code in grammar but while opening the project the validation error is displayed and disappeared in seconds.
TypeRef:
type=[Type | QualifiedName ]
But if i have changed the QualifiedNameWithWildcard with QualifiedName , i am able to show the validation error but wildcard import support is breaking. I have tried the following code it is not working.
Import:
'import' importedNamespace= QualifiedName ';'
Import:
'import' importedNamespace= QualifiedName | importedNamespace= QualifiedNameWithWildcard ';'
Where am i going wrong?
can anyone please explain the following link:
Eclipse Xtext Naming where they have mentioned the follwing code is working. Import returns EuclidImport :
'import' (
importedNamespace=QualifiedName
| importedNamespace=QualifiedNameWithWildCard) ';'?
;

Related

Migrating from MUI v4 to v5: Can't declare module "#mui/styles/defaultTheme"

I'm attempting to follow Material-U's instructions to migrate from MUI v4 to MUI v5, but ran into the troubleshooting issue Property "palette", "spacing" does not exist on type 'DefaultTheme.'
I'm following the troubleshooting suggestions listed here, and added the following code to my theme.tsx file:
import { Theme } from '#mui/material/styles';
declare module '#mui/styles/defaultTheme' {
interface DefaultTheme extends Theme {}
}
but get the following error on the line declare module "#mui/styles/defaultTheme in theme.tsx:
Invalid module name in augmentation, module '#mui/styles/defaultTheme' cannot be found.ts(2664)
module "#mui/styles/defaultTheme"
That code snippet does not throw the same error if I include it in App.tsx, but including it in App.tsx does not silence the Property "palette","spacing" does not exist on type 'DefaultTheme error.
How can I either a) avoid the invalid module name in augmentation error in theme.tsx or b) overcome the does not exist on type DefaultTheme error in a different way?

Typescript: code looks correct, compiler complains

I'm starting to work with typescript. So far, the experience has been pretty positive.
This morning I'm taking over 2 existing projects, which are currently deployed in production and work. And thus compile. Both projects have the same tsconfig and nodejs config as far as I can tell. One of them compiled without any issue.
The other one is a different story. The compiler seems to stumble on valid code, and I have honestly no idea what's wrong.
For example, it fails on the first line of a file:
src/services/user-agent.service.ts:1:13 - error TS1005: '=' expected.
1 import type { lookup } from 'useragent';
~
src/services/user-agent.service.ts:1:29 - error TS1005: ';' expected.
1 import type { lookup } from 'useragent';
~~~~~~~~~~~
I have a limited knowledge of typescript, so maybe this is an old, deprecated way of writing code? I looked up the documentation, it looks ok to me.
Also this first line of a function:
src/handlers/my-handler.ts:15:31 - error TS1109: Expression expected.
15 const companyId = payload?.content?.customer?.id;
~
src/handlers/my-handler.ts:15:40 - error TS1109: Expression expected.
15 const companyId = payload?.content?.customer?.id;
~
src/handlers/my-handler.ts:15:50 - error TS1109: Expression expected.
15 const companyId = payload?.content?.customer?.id;
~
src/handlers/my-handler.ts:15:53 - error TS1005: ':' expected.
15 const companyId = payload?.content?.customer?.id;
~
I'm using Visual Studio Code to edit this code, and it doesn't complain about anything. Linters also pass.
Versions:
nodejs: 10.24.0
npm: 5.8.0
typescript: 4.1.2
tsc: 3.3.3333
running in Debian on WSL2
I build with npm run build, which is using tsc behind the scenes. Again, this seems to work for one project, but not for the other, so there must be a difference, but I'm not sure where to look.

Stories not rendering in 6.1.15 version of storybook

My main.js file:
Its not rendering stories inside Header.stories.js
Even I have explicitly included Header.stories.js but still the same issue, it's not being rendered.
Please see if anyone could help me with this as I am really stuck on this issue.
PS: Use following repo to reproduce the issue or to see the implementation!
click here to see the repo
You have this error in the console :
WARNING in ./src/components/Header.stories.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: Storybook_demo/my_storybook/src/components/Header.stories.js: Const declarations require an initialization value (16:20)
14 | }
15 |
> 16 | export const Primary ()=>(<Header >'hii'</Header>);
| ^
I can see the =sign in your file, I honestly don't know why it doesn't work. It's look like a bug in a babel parser ?
However, you can make it work with juste a space between Primary and =:
export const Primary = ()=>(<Header >'hii'</Header>)

error: cannot find symbol if (!"ovpn3".equals(BuildConfig.FLAVOR))

When I create vpn app I am geting this type of error plz someone help me in this
C:\Users\asus\Desktop\WorkBook\UltimateVpn\app\src\main\java\de\blinkt\openvpn\core\OpenVPNService.java:472: error: cannot find symbol
if (!"ovpn3".equals(BuildConfig.FLAVOR))
^
symbol: variable FLAVOR
location: class BuildConfig
I am facing the same problem. You are using old ics-vpn library. You can see not exist "BuildConfig.flavor" line anymore.
Libary Url : ics-openvpn/OpenVPNService.java

Parsing error: Invalid regular expression: /\p{Lu}/: Invalid escape (Unicode general category properties)

ESLint 7.0.0 appears to have a problem with Unicode general category properties in regular expressions.
In one file, I'm getting this error message:
Parsing error: Invalid regular expression: /\p{Lu}/: Invalid escape
I'm getting it in other files as well, but this is the most simple expression on which I'm getting it.
It's a valid expression. Works just fine when I run the code. But it's breaking my ESLint run.
What setting do I use to get ESLint to accept these expressions?
Problem seems to disappear by adjusting .eslintrc.json slightly:
"parserOptions": {
"ecmaVersion": 2019
}

Resources