I am trying to lint json files with eslint. Is there a way to do that with esline or is there a plugin I can use for that purpose? Thanks.
I solved it by installing the eslint-plugin-json module, then add 'json' type to the plugins section in .eslintrc
I can then lint json files like this
eslint . --ext .json
I tried eslint-plugin-json, but it won't auto-fix your json for you, meaning you have to manually fix the lint issues.
So I made eslint-plugin-json-format, which has auto-fixing built-in.
It will also (optionally) sort your package.json for you
eslint --ext .json . --fix
Related
I try to implement eslint rules for json files, like I have rule :
"quotes": ["error", "single"]
but I don't want this rule to concern json files, only ts/tsx/js/jsx files. how can I specify rules for special formats?
I try to remove json format from src but it's not a solution
https://eslint.org/docs/latest/user-guide/command-line-interface#-ext suggests:
# Use both .js and .ts
npx eslint . --ext .js --ext .ts
# Also use both .js and .ts
npx eslint . --ext .js,.ts
so in your case:
npx eslint ./src --ext .ts,.tsx,.js,.jsx
I want convert some wordpress .po language files to .json format and used wp-cli but PO files converted to multi files of json but I need to a single json file.
So installed po2json using:
npm install po2json
I am getting this error:
C:\Users\Mehdi\Desktop\po2json 1.0.0>po2json translation.po translation.json
'po2json' is not recognized as an internal or external command,
operable program or batch file.
Can anybody help me to use po2json easily?
I have tried to install https://openbase.com/js/#myrotvorets/po2json using:
npm i #myrotvorets/po2json
And finally I got the output with the following code:
po2json sourcefile.po > destfile.json
I pulled a GIT project in bitbucket and encountered this error when I tried to "ionic serve" the project. In the owner's project, there was no error detected.
It seems that you probably have some format issue on your package.json. To know where this comes from, simply copy the content of your package.json using your code editor or your CLI ($ cat package.json | pbcopy) and paste it into jsonlint. It will show you which part is badly formatted.
I'm trying to achieve similar viewer annotations like official demo:
lvm-react
I read official blog post and use files from Autodesk Extensions github:
http://adndevblog.typepad.com/cloud_and_mobile/2016/04/markup3d-sample-for-view-data-api.html
But I can't compile extensions from sources (create bundle.js). Tried just npm install, but there are many errors like:
ERROR in ./src/Viewing.Extension.VisualReport/PieChart/PieChart.js
Module not found: Error: Cannot resolve module 'EventsEmitter' in MY_FILES
and
ERROR in ./src/Viewing.Extension.StateManager/Viewing.Extension.StateManager.scss
Module parse failed: /MY_PATH/library-javascript-viewer-extensions-master/src/Viewing.Extension.StateManager/Viewing.Extension.StateManager.scss Unexpected token (2:0)
You may need an appropriate loader to handle this file type.
I also installed webpack using npm, but without result, there are still many errors.
There was a few loaders missing from the webpack build production config. It is fixed now and you should be able to build all extensions. Please use the latest version from the repo.
When testing your extensions, I recommend you use npm run build-dev command, so the generated extensions files will not be minified and have source-map enabled, so you can easily debug them in browser console. When building for production, you can use npm run build-prod.
You can also remove the various entries from the webpack config to build only the extensions you are interested in, for example:
module.exports = {
devtool: 'eval-source-map',
entry: {
'Viewing.Extension.Markup3D':
'./src/Viewing.Extension.Markup3D/Viewing.Extension.Markup3D.js',
},
// ... rest of the config ...
You may also want to change the output path, in my config the output is outside of the extensions directory, directly in the project using them:
output: {
path: path.join(__dirname, '../../App/dynamic/extensions'),
filename: "[name]/[name].js",
libraryTarget: "umd",
library: "[name]",
watch: true
},
In addition to including the extension file to your project, you should also make sure that you include the babel polyfill (from node_modules/babel-polyfill/dist/polyfill.min.js) before any extension script.
Hope that helps, let me know if you have any further trouble using those extensions.
I am very new to the concept of npm-install. Please throw some insights into where I might be going wrong. I have a .js file through which I am supposed to invoke a binary with some command line arguments.I did write package.json setting the main parameter to the javascript file and I am using preinstall script that compiles the code and creates a binary that is supposed to be used by my java script file.
Couple of questions:
How do I make package.json take this compiled binary as dependency for the js file?
npm install runs fine for me but I do not see any output folder whatsoever. I was hoping it would generate a .node_module in pwd and copy the contents onto bin/ folder in that. May be, I am missing something.
npm info prepublish test#0v.0.1
npm verb from cache <pwd>/package.json
npm verb readInstalled returning test#0.0.1
npm verb exit [ 0, true ]
npm info ok
Can someone please through some insights into this issue?
You don't have to include your binary file in package.json. If you're using Express, put it in the node-modules folder within the parent directory. Otherwise, you can either specify the whole path to the file where you call it or put the file in the parent directory. For global installations, the node-modules folder is usually created at: C:\Users\[Username]\AppData\Roaming\npm\node_modules.
I figured out a way to handle it. Using a js module and using my node as required in that module causes npm to setup my node in node_modules/ folder. I used a pre-install shell script to compile my binary and used the relative path to use the binary upon execution.
Thanks for all who replied.