Eslint rules for json files - json

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

Related

In WebStorm don't work Pug's argument "--pretty"

In WebStorm don't work Pug's argument "--pretty"
HTML file looks like:
But I want:
Please advise what to do?
I do not want to write on the command line
pug --watch --pretty ./pug/ --out ./html/
I want to make the default setting.
Works fine for me when using the following setup:
Arguments: $FileName$ --pretty --out $ProjectFileDir$/html
Output paths to refresh: $ProjectFileDir$/html/$FileNameWithoutExtension$.html
the file in your screenshot doesn't seem to be produced by a file watcher - it's location doesn't match the output directory in your file watcher settings

Customize directory destination for ES6 compiled files via Babel watcher in PhpStorm

I have a directory structure like below:
All ES6 files are in the js directory. Now I want after compiling those files to put all of them into a dist directory but I do not know how can I do that.
I've added a Babel watcher in PhpStorm that has this configuration :
program :
D:\wamp\www\vuejs\node_modules\.bin\babel.cmd
Arguments :
$FilePathRelativeToProjectRoot$ --out-dir dist --source-maps --presets env
Output path to refresh :
dist\$FileDirRelativeToProjectRoot$\$FileNameWithoutExtension$.js:dist\$FileDirRelativeToProjectRoot$\$FileNameWithoutExtension$.js.map
What changes should I make in the watcher configuration?
It can look as follows:
Arguments : $FileName$ --out-dir $ProjectFileDir$\public\dist\$FileDirPathFromParent(js)$ --source-maps --presets env
Output path to refresh : $ProjectFileDir$\public\dist\$FileDirPathFromParent(js)$\$FileNameWithoutExtension$.js:$ProjectFileDir$\public\dist\$FileDirPathFromParent(js)$\$FileNameWithoutExtension$.js.map
Working directory: $FileDir$
Note that Working directory: field is usually hidden, you need to expand Other Options: to see it

Convert a single Scss file to CSS using compass-watch

I am tired to convert Scss modules to CSS one by one manually. I just want to convert my individual Scss file from many modules. I am using compass watch on command line based compiling CSS through ruby on rails service for compass.
Here you can see how I am managing Scss to CSS conversion through ror cli.
You can create a scss or sass file where you will import all partials.
Example: create a sass file inside your sass directory and name it as you want, maybe app.sass.
Inside app.sass, import all you partials like so: #import 'partials/button-actions'
Create config.rb in the directory where you starting watcher. I prefer to use the project root directory.
Inside config.rb insert:
require 'compass/import-once/activate'
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
# Change paths to yours. css_dir is css output directory, sass_dir is your sass file directory
http_path = "/"
css_dir = "css"
sass_dir = "sass"
images_dir = "i"
javascripts_dir = "js"
# You can select your preferred output style here (can be overridden via the command line):
# output_style = :expanded or :nested or :compact or :compressed
output_style = :compressed
# To enable relative paths to assets via compass helper functions. Uncomment:
# relative_assets = true
# To disable debugging comments that display the original location of your selectors. Uncomment:
# line_comments = false
# If you prefer the indented syntax, you might want to regenerate this
# project again passing --syntax sass, or you can uncomment this:
preferred_syntax = :sass
# and then run:
# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass
And start watcher. You will get an app.css file which contains all the code from the imported files as the result. Import it into your HTML.

package.json webpack linting json file with eslint

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

JetBrains WebStorm ignoring watcher settings

I'm using pug/jade watcher with the following "Output paths to refresh": $ProjectFileDir$\html\$FileNameWithoutExtension$.html. This should save the output in /html but for some reason it saves it next to the jade file.
You need changing Jade watcher arguments accordingly:
Arguments: $FileName$ --pretty --out $ProjectFileDir$/html
Working directory: $FileDir$
Output paths to refresh: $ProjectFileDir$/html/$FileNameWithoutExtension$.html