phplint deactivated + phpcs deactivated - sublimelinter

I'm trying to make SublimeLinter work on my Linux. On Sublime Text console I have this errors:
SublimeLinter: WARNING: phplint deactivated, cannot locate 'phpl'
SublimeLinter: WARNING: phpcs deactivated, cannot locate 'phpcs'
SublimeLinter's path, I have configured like this:
"paths": {
"linux": ["/usr/local/lib/node_modules/jshint/bin",
"/usr/local/lib/node_modules/csslint/bin",
"/usr/bin/php -l", "/opt/lampp/bin"],
"osx": [],
"windows": []
},
What is missing?

Related

How to debug unconverted source code correctly in react18 jest unit test?

Environment:react18 source code, win10 , node v16.13.1
I'm using jest tests inside the source code to explore the react18 source code,but jest use babel to convert source code, when i debug jest unit test,it will jump to babel's converted code,it is hard to read,
So I want to ask is there any way to debug on the source code,not the converted code?
for Example:
when i debug it,it will be converted
Even in some places,It's almost unreadable:
i want to debug unconverted source code correctly in react18 jest unit test.
here is my vscode lanuch.json config:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Jest Current File",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": [
"${fileBasenameNoExtension}",
"--config",
"./scripts/jest/config.source.js",
"--runInBand"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"env": {
"NODE_ENV": "development"
},
"windows": {
"program": "${workspaceFolder}/node_modules/jest/bin/jest",
}
}
]
}
i found in 'preprocessor.js' file , it contain babel configuration
so,we just add global item process.env.JEST_ENABLE_SOURCE_MAPS : inline.

Passing targets in as a dependency and making sure they output something useful and meaningful to be consumed by next target

I am trying to get a plugin to use run-commands and I want it to run and execute a dependent task and pass the result to my command. In this case, I want to have a dependent target start up a webserver and keep it running.
I have tried to do the following and nx graph shows the right DAG but I am not seeing the output I want.
"executor": "nx:run-commands",
"options": {
"command": "./my-cli-tool --arg={frontendApp:serve}"
},
"dependsOn": [
"frontendApp:serve"
]
I know that in a monorepo tool like bazel, passing around the target like //frontendApp:serve would do what I am expecting here so I am guessing there should be a way to do this in nx.
Update: To help with debugging.
If the dependency is running, it is failing silently. I can run it individually, e.g. npx nx run frontendApp:serve. I can't see the port starting up and being taken so if something is happening, its happening silently.
dependsOn configuration looks a little different. It's in the docs here:
https://nx.dev/reference/project-configuration#dependson
Basically, you need have a local target which invokes the target in the other project.
{
"foo": {
"executor": "nx:run-commands",
"options": {
"command": "./my-cli-tool --arg={frontendApp:serve}"
},
"dependsOn": ["serve"]
},
"serve": {
"executor": "nx:run-commands",
"options": {
"command": "nx run frontendApp:serve"
}
}
}
Another option is to use Angular DevKit's allOf or concat executors for running multiple things at once:
"serve-with-graphql": {
"executor": "#angular-devkit/architect:allOf",
"options": {
"targets": [
{
"target": "web:serve"
},
{
"target": "graphql:dev-server"
}
]
}
},
https://github.com/angular/angular-cli/blob/main/packages/angular_devkit/architect/builders/builders.json#L14-L23
allOf runs each target at the same time
concat runs them serially

(Prettier, ESlint, Airbnb) not auto-fixing problems on save (ReactJS) [duplicate]

I am using ESLint in my Vue(Nuxt) project in VSCode. When I save I would like my ESLint to run automatically and fix all the warnings for me automatically.
This is my settings.json file in VSCode:
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"vetur.format.defaultFormatter.js": "vscode-typescript",
"vetur.validation.template": false,
"vetur.completion.scaffoldSnippetSources": {},
"vetur.completion.useScaffoldSnippets": false,
"vetur.format.defaultFormatter.html": "none",
"workbench.iconTheme": "material-icon-theme",
"git.autofetch": true,
"git.defaultCloneDirectory": "",
"gitlens.views.repositories.files.layout": "list",
"editor.tabSize": 2,
"editor.detectIndentation": false,
}
And this is my .eslintrc.js file:
module.exports = {
root: true,
env: {
browser: true,
node: true,
},
extends: [
"#nuxtjs",
"plugin:nuxt/recommended",
"../.eslintrc.js"
],
rules: {
//Add custom rules for the frontend here.
//Rules that are common for shared, frontend and backend should go in the parent file
"nuxt/no-cjs-in-config": "off",
},
}
The linked ../.eslintrc.js file contains the following:
module.exports = {
parserOptions: {
parser: 'babel-eslint',
},
plugins: ['jest'],
rules: {
'prefer-const': 'off',
'comma-dangle': ['error', 'always-multiline'],
'prefer-template': 'error',
},
env: {
'jest/globals': true
}
}
Whenever I save the file the warnings just show up and will not automatically fix themselves.
EDIT:
I've turned on verbose output and i'm seeing this in the output:
(node:6832) UnhandledPromiseRejectionWarning: Error: Failed to load plugin 'import' declared in 'frontend\.eslintrc.js » #nuxtjs/eslint-config': Cannot find module 'eslint-plugin-import'
Require stack:
I've then ran yarn add eslint-plugin-import and tried again, it still returns the same error.
Get eslint plugin, add this code to your settings.json
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"eslint.validate": ["javascript"]
}
source
Launch VSCode,
Command + Shift + P, type settings and hit enter, paste and save the following:
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
}
}
You're good to go!
I've managed to fix the issue.
The problem was that there were multiple working directories in my solution, which all have their own eslint config.
Putting the following line in the settings.json file of VSCode solved my issue:
"eslint.workingDirectories": [{ "mode": "auto" }]
I tried those solutions and others, and it still didn't work. Actually it was just that ESLint's use had to be approved for use in VSCode. That is, I clicked on the ESLint item on the editor's bottom bar:
Which opened a popup asking me to approve ESLint. After approval autocorrect was running as expected.
Install ESLint extension from the VSCode marketplace.
Once the ESLint extension has installed you may use CTRL + SHIFT + P to open the Command Palette. Search “ESLint fix all auto-fixable Problems” and press enter.
This command would enable eslint to fix the file on save.
In the snap above as you can see that I am getting eslint errors and just to inform you all that despite saving the file, all auto-fixable problems are were not getting fixed by eslint/prettier setup.
So I tried pressing ctrl+shift+p and selecting prettier as default formatter and also tried doing eslint restart server but that didn't worked.
I noticed that vscode was giving me some notifications at the bottom right corner (bell icon). I clicked on that and some list of pop up came up stating that there are multiple formatters installed for the same extension file. Like for example in the below snap there is .jsx file(it had two formatters one was prettier and other was vscodes inbuilt formatter). I clicked on configure button and selected prettier as default and when I saved the file it worked!
If this doesn't works for you then I think this all worked for me because I had eslint npm packages installed in my project that works with prettier to enforce the prettier rules. (these packages are eslint-config-prettier and eslint-plugin-prettier)
I ran into a similar problem-- ESLint was not properly formatting only certain, seemingly random, files on save. Running ESLint --fix would fix the formatting errors, but saving would not. Adding this line to our workspace settings.json fixed the problem:
"eslint.format.enable": true,
Making all our formatter settings look like this:
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": true
},
"eslint.format.enable": true,
You can also go into the ESLint extension settings and check off the checkbox labeled ESLint > Format:Enable. Worked like a charm!
What fixed it for me was adding this to settings.json, because VSCode didn't know what formatter I wanted to be used on save:
"[javascript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
Check if in the settings.json there are other formatters enabled, in my case I had this by mistake.
"[javascript]": {
"editor.defaultFormatter": "vscode.typescript-language-features"}
After getting the Eslint plugin you need to add this line to the settings.json:
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
}
Still not working? check if your eslint works fine by running this in the terminal:
eslint --ext \".js,.vue\" --ignore-path .gitignore .
If it failed with exit code 2 try removing node modules and install again.
After running this command you should see the eslint errors.
I was dealing with the same issue, and nothing seemed to help, even though I did all the configurations correctly, and ESLint was marking the problems in my files correctly.
For me the solution was to move the .vscode folder to the project root.
Now everything works as intended.

nextjs v12 swcMinify set to true

decided to get rid of my babelrc as the new rust compiler is being promoted and encouraged by vercel. however doing so immediately breaks my build. this is the only thing in my babelrc.
{
"presets": ["next/babel"],
"plugins": [["styled-components", { "ssr": true, "displayName": true }]]
}
and this is the error after i add
module.exports = {
swcMinify: true
to my next.config.js and i run next build
not sure what i'm missing here since development build works fine, just the build that seems to be breaking on compile. any help would be appreciated
Edit: as requested, this is the entire error
static/chunks/pages/_app-434406ef89d5b351.js from Terser
error: 'eval' and 'arguments' cannot be used as a binding identifier in strict mode
|
97440 | function eval(str) {
| ^^^^
Caused by:
0: failed to parse input file
1: error was recoverable, but proceeding would result in wrong codegen
2: Syntax Error
Error: error: 'eval' and 'arguments' cannot be used as a binding identifier in strict mode
|
97440 | function eval(str) {
| ^^^^
Caused by:
0: failed to parse input file
1: error was recoverable, but proceeding would result in wrong codegen
2: Syntax Error
Create a new file and name it .babelrc (if it does not exist) and add following content:
{
"presets": ["next/babel"]
}
Also open next.config.js and add swcMinify:false

Visual Studio 2019 debug embedded targets. How to force VS to not treat it as a windows executable

I am trying to set up Cmake ARM uC (STM32) embedded project in the VS 2019.
Project buils OK but I struggle to start the debug session.
I have amended launch.vs.json
{
"version": "0.2.1",
"defaults": {},
"configurations": [
{
"type": "cppdbg",
"name": "GCEC-FW.elf",
"project": "out\\build\\IoT-Debug\\GCEC-FW.elf",
"projectTarget": "",
"cwd": "${workspaceRoot}",
"program": "${workspaceRoot}\\BUILD\\${workspaceRootFolderName}.elf",
"MIMode": "gdb",
"externalConsole": true,
"inheritEnvironments": [
"gcc_arm"
],
"miDebuggerPath": "${env.gccpath}\\bin\\arm-none-eabi-gdb.exe",
"setupCommands": [
{
"text": "-environment-cd ${workspaceRoot}/BUILD"
},
{
"text": "-file-exec-and-symbols ${workspaceRootFolderName}.elf",
"description": "load file",
"ignoreFailures": false
},
{
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"visualizerFile": "${debugInfo.linuxNatvisPath}",
"showDisplayString": true,
"miDebuggerServerAddress": "localhost:3333",
"launchCompleteCommand": "None",
"debugServerPath": "C:\\Program Files (x86)\Atollic\\TrueSTUDIO for STM32 9.3.0\\Servers\\J-Link_gdbserver\\JLinkGDBServerCL.exe",
"debugServerArgs": "-port 2331 -s -CPU Cortex-M -device STM32F427II -endian little -speed 4000 -vd -swoport 2332",
"serverStarted": "GDB\\ server\\ started",
"filterStderr": true,
"filterStdout": true
}
]
}
But when I try to start the debug session I am getting error stating that my .elf file is not an win32 executable (which is actually correct - it is not).
The question is: what has to be done VS to start this session?
edit
I needed to change the name when adding appending the new microcontroller debug configuration.
"name": "GCEC-FW.elf"
Now it complains about the path to the gdb.
The new question is: can I output or see build variables in VisualStudio - Like
${workspaceRootFolderName} or ${env.gccpath}
Regarding "... can I output or see build variables in VisualStudio - Like: ${workspaceRootFolderName} or ${env.gccpath}
To display all of the currently available macros, in the Property
Pages dialog, under VC++ Directories, choose the drop-down arrow at
the end of a property row. Click on Edit and then in the edit dialog
box, choose the Macros button. The current set of properties and
macros visible to Visual Studio is listed along with the current value
for each. For more information, see the Specifying User-Defined Values
section of C++ project property page reference.
More here about that.

Resources