All Questions
Tagged with rules javascript
53
questions
0
votes
1
answer
53
views
TypeError: registrationRules is not a function
Help me understand what the problem is. When I start the project, an error comes up:
TypeError: registrationRules is not a function at Object.<anonymous> (C:\Users\fenrir\Desktop\chat-app\chat-...
0
votes
0
answers
86
views
ESLint custom rule - no spaces for property access
I've configured my ESLint for node project with
'no-multi-spaces' : ['error'],
rule. It automatically fixes object .property to object .property
object.
property
to
object
. property
, but I'm ...
0
votes
1
answer
115
views
Passing dynamic values inside a regular expression statement is not working? [duplicate]
I have a validation rule on an input field that allows a maximum of three words to be typed and I am using a regex rule (/^\s*(?:\S+(?:\s+\S+){0,2}\s*)?$/) to validate this.
Now, I don't want to ...
0
votes
1
answer
287
views
ESLint Rule to restrict from importing full SDKs
In my project, developers import full SDKs instead of only specific modules.
For example:
const CognitoIdentityServiceProvider = require('aws-sdk');
Here^ developer wants to use ...
0
votes
2
answers
25
views
Normative issues: Problems with function parameter rules
// the problem is not related to axios, just use it as an example
axios.get(url[, config])
[, config] means "config" is optional, but why is it optional. What specification is it based on? ...
0
votes
0
answers
91
views
How can I return a validation rule depending on the response status of the request (ReactJS/AntDesign)
I would like to know how I can return a validation rule depending on the response of a request.
I have an input which, when the user finishes writing, performs a GET where it obtains if the user who ...
0
votes
1
answer
182
views
Alfresco Add Category based on Tag
I would like to create a script to use as a folder rule to add a category based on the tag.
This script successfully adds the category to the file.
var catNodeRef = search.findNode("workspace://...
1
vote
1
answer
277
views
How to get org_id as part of access token using Auth0?
I am try to get get org_id While generating using UserNamePassword authentication?
I have added rule as below
context.accessToken[namespace + 'org'] = context.organization;
After generating access ...
1
vote
1
answer
705
views
Can I write my own custom rule in eslint config?
Is it possible to write custom rule in eslint config?
My case is based on type 'any'. In eslint doc is rule "@typescript-eslint/no-explicit-any", but it's too strong for me. I want to block ...
0
votes
3
answers
953
views
CASL behavior if subject has no rules
When not providing any rule for a given subject in CASL checking an ability for this subject always returns false.
E.g.
import { Ability } from '@casl/ability';
const ability = new Ability({
...
2
votes
0
answers
58
views
Common Regular Expression for java and Javascript
I am looking to have a common framework to write some syntactic validation rules in regular expressions so that I can use them in both frontend and backend.
I am using javascript for the front end and ...
0
votes
0
answers
42
views
Rule runs out of order and it finishes after the hook finishes
I am encountering a very strange problem.
I have 4 rules in my Auth flow.
Add user metadata from idp -> Adds some fields on the user_metadata from the identity provider
the rule that has the ...
0
votes
1
answer
614
views
Is there a way for the typescript compiler to throw an error when using the "any" type explicitly? [duplicate]
I am trying to make my code as strict as possible with TS. Is there a way to make the following declaration using "any" as a type to throw an error since it should be a "string" ...
65
votes
4
answers
57k
views
Why eslint consider JSX or some react @types undefined, since upgrade typescript-eslint/parser to version 4.0.0
The context is pretty big project built with ReactJs, based on eslint rules, with this eslint configuration
const DONT_WARN_CI = process.env.NODE_ENV === 'production' ? 0 : 1
module.exports = {
...
2
votes
0
answers
278
views
Custom rules ESLint for using Array.push instead of direct assignment to add items to an array
I want to create a custom rule to prevent giving values directly to the array, and encourage using array.push
e.g
const newArr = ['test', 'tust'];
// invalid
newArr[newArr.length - 1] = 'lorem ipsum';...