I created a vue-js CLI project
I want to be able to use double-quotes instead of single quotes
when I use double quotes, npm run dev reports eslint errors
Where do I tell eslint to allow double quotes?
Check your .eslintrc.js file, you can either set the value of the quotes rule to double or set the error level to warning or disable it altogether. Have a look at the docs. This would be an example:
"rules": {
"quotes": ["error", "double"]
}
quotes: [0, "double"] works for me
Sometimes it is cumbersome to find a specific syntax to disallow a specific eslint rule. In this situations you can use "global" disabling for a code block as the following:
/*eslint-disable */
//suppress all warnings between comments
console.info("foo");
/*eslint-enable */
If you use the ESLint extension https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint.
It comes with a command to initialize the .eslintrc file :
Run
Ctrl+Maj+P
then
ESLint : Create ESLint configuration
In the resulting .eslintrc.js file that has been generated at the root of your Workspace add the quotes: [0, "double"] line as stated by others.
File should look something like this
module.exports = {
quotes: [0, "double"]
}
Another way which is the easier one is to just go into the.eslintignore file and add * at the end of the file will do the magic for you
The following rule will get rid of the double quotes error however then you will start getting single quotes error:
"rules": {
"quotes": ["error", "double"]
}
And if you want to disable the quotes rule then add this:
rules: {
quotes: "off"
}
Related
I have this problem: I'm using Vue CLI with Vetur/Volar, and as u can see from the pic, i wish i could see indentation line also between the empty spaces. Vs code automatically indent everything like that by itself in my case, but, with some empty spaces without lines. And (more strange) i have in my project only 'one' file (a FooterPage.vue file as all the other .vue, nothing different) that's indent in the correct way....only in that file... I actually decided to remove indentation line because is frustrating
[enter image description here](https://i.stack.imgur.com/vJIjW.png)
I need the Indentation lines like the Footer vue file from the system and not like the other pic
Try adding this to your user settings.json or your workspace's .vscode/settings.json file:
"[css]": {
"editor.indentSize": 3,
"editor.detectIndentation": false
}
I have a simple issue "Array and string offset access syntax with curly braces is deprecated", but I am not sure where to go to fix it.
How do I enable line numbers to show?
you can activate the debug function in main.php file. This file located in protected/config folder.
Edit as following:
locate the 'log' array inside the file
uncomment the CWebLogRoute in the array
If you do it right, then when error shows up, you can see the error location.
How your main.php log config looks like when uncomment
I have a question with VSCode. I developed tests with Cypress and VS didn't show any problem. In fact, this tests are working right now. However, VS Code shows a lot of stranges errors today. For example 'describe' is not defined. (no-undef)' or 'Expected indentation of 4 spaces but found 8. (indent)' as you can see in the image.
I did not change the VS Code Settings. Why is it happening?
UPDATE: I think the problem is the new version of Cypress 7.5, but i have not found a solution yet
I tried to fix that with this steps:
File / Preferences / Settings then Text Editor (or just search for 'tab' in the search settings box)
Then remove the tick from the following settings:
Insert Spaces
Detect Indentation
But it didnt' work. FInally, I had to remove the JS6 VS Extensions and this errors dissapeared.
That was My problem too, The exact error was:
Expected indentation of 4 spaces but found 6. eslint(indent)
And to fix that, I just let ESLint knows that "I don't want it to take care of those indentations".
There're two approaches for that (base on the eslint docs):
1. Using configuration comment
Put the following comment at the very top of each file you want that indentation to be ignored:
/* eslint-disable indent */
2. Using configuration file
To disable the indentation rule for a group of files (ex. test.js or spec.js), use the following code snippet in the .eslintrc file:
{
/* Whatever's here */,
"overrides": [
{
"files": ["*-test.js","*.spec.js"],
"rules": {
"indent": "off"
}
}
]
}
Whilst this script is using gulp 4.0.0-alpha.2, I suspect that the script was originally written for 3.x.
I have a gulp script that I inherited which has the following task present:
pump([
gulp.src(['app\\images\\**\\*.*']),
gulp.dest('.dev\\images')
] , done);
(The values passed into .src and .dest were originally retrieved from elsewhere but there doesn't appear to be any code that modifies them)
The app\images folder contains an icons sub-folder which contains multiple files, the result of the gulp script is:
On 4.0.0-alpha.2, these files get placed in .dev\images\icons
On 4.0.2, these files get paced in .dev\images\app\images\icons
It appears that the two full paths get concatenated now, whereas previously only the relative paths from the glob (i.e. when app\images\**\*.* found app\images\icons\icon1.png it returned icons\icon1.png).
Passing base into the options when calling src appears to resolve this:
pump([
gulp.src(['app\\images\\**\\*.*'], { base: 'app\\images\\' }),
gulp.dest('.dev\\images\\')
] , done);
This doesn't solve cases where an array of paths with disparate base paths is passed, e.g:
['app\\styles\brand\**\*.*', 'app\\brands\icons\icons.data.svg.css']
It also seems likely that there's a more generic solution available that doesn't require me to update every invocation of src, so....
How can I obtain the same behaviour using Gulp 4.0, where only the glob onwards, or the name of the file is used when writing to the destination?
Minimal repro gulpfile.js:
'use strict';
const gulp = require('gulp');
exports.build = function()
{
return gulp.src(['app\\images\\**\\*.*'])
.pipe(gulp.dest('.dev\\images'));
}
And package.json:
{
"name": "test-web",
"version": "1.0.0",
"description": "Test Project",
"main": "gulpfile.js",
"scripts": {
"build": "gulp build"
},
"author": "Me",
"license": "ISC",
"devDependencies": {
"gulp": "^4.0.2"
}
}
There are files under app\images\android and app\images\apple (2 in each)
Result with gulp#4.0.0-alpha.2 (expected/desired):
.dev\images\android\1.png
.dev\images\android\2.png
.dev\images\apple\1.png
.dev\images\apple\2.png
Result with gulp#v4.0.2 (un-expected):
.dev\images\app\images\android\1.png
.dev\images\app\images\android\2.png
.dev\images\app\images\apple\1.png
.dev\images\app\images\apple\2.png
From path separators in globs, gulpjs docs:
Segments and separators
A segment is everything between separators. The separator in a glob is
always the / character - regardless of the operating system - even in
Windows where the path separator is \\. In a glob, \\ is reserved as
the escape character.
And from the glob docs: Windows paths:
Please only use forward-slashes in glob expressions.
Though windows uses either / or \ as its path separator, only /
characters are used by this glob implementation. You must use
forward-slashes only in glob expressions. Back-slashes will always be
interpreted as escape characters, not path separators.
So your glob ['app\\images\\**\\*.*' is definitely a problem as it has escape sequences rather than the required / path separators.
In particular, glob (or gulp) is not able to figure out the base with all the escape sequences in there. When you explicitly set the base apparently that fixes the problem.
It isn't clear to me why your glob actually finds anything, perhaps because of this:
If an escaped pattern has no matches, and the nonull flag is set, then glob returns the pattern as-provided, rather than interpreting the character escapes.
From glob docs. The nonull flag is set by default.
Your original code produces the "un-expected" result for me in Local version 4.0.0-alpha.3, I don't know why it worked differently in alpha.2. Given the escaping issues I would say the "un-expected" result is the correct result, as the base either cannot be determined or is null.
Interestingly, the problem can be fixed by simply using this:
return gulp.src(['app\\images/**\\*.*']) // note the one forward slash
Apparently that is enough to allow the base to be accurately determined. Of course, as the docs say, only forward slashes should be used in the glob portion.
So that explains the problem with your code but not why the heck you got different results in gulp#4.0.0-alpha.2 but not alpha.3 or 4.0.2???? But I strongly suspect it is related to gulp alpha src issues. It "worked" in alpha.2 but working was itself a bug, it shouldn't have worked and that bug (which allowed incorrect code to work) was fixed later.
I changed the user setting from preference and saved it. Then i tried to open editor but i get the error message. So i uninstalled and installed it again. Though, no use. Also the path mentioned in the error message also is not there.
The error message is:
Error trying to parse setting: Trailing comma before closing bracket in C:\Users
Rajanand\AppData\Roaming\Sublime Text 2\Packages\User\Preferences.sublime-settings:5:1
What am I missing here?
Go to Preferences > Settings - User. AppData is hidden by default in Windows, show with the explorer's folder options.
Your problem is that you have an extra comma somewhere in that file. Remove the comma from the last setting in any list. Without seeing that file, I can not tell you where exactly. Here are examples:
{
setting1,
setting2,
last_setting,<-- remove
}
Remove the comma from the last setting.
or
{
setting1,
setting2:
[
setting2_item1,
setting2_last_item,<-- remove
]
}
Remove the comma from setting2_last_item.
or
{
setting1:
[
setting1_item
],
setting2:
[
setting2_item
],<-- remove
}
Remove the comma after setting2's list.
The above answers helped me out on sublime text 3
But just wanted to add this...
For newbies like me, if you want to add your custom settings and you tried adding it to the Preference file and you're getting the error too... In my case I did like the following...
{
"ignored_packages":
[
"Vintage"
], // <-- I put the comma there so I can add the below, new setting.
"tab_size": 2 //My new setting
}