How could I use the same tslint.json in submodules, too? - json

A big Angular 5 project is given with several submodules (from different repositories) and I couldn't specify the path to neither node_modules/codelyzer nor tslint-base.json from a submodule's tslint.json.
The tree is something like this:
tslint-base.json
node_modules
...
modules
submod1
tslint.json
components
...
submod2
tslint.json
components
...
tslint-base.json:
{
"rulesDirectory": [
"node_modules/codelyzer"
],
"rules": {
...
}
}
Of course it works well when we open the root of the project with IDE (IntelliJ IDEA Ultimate), but we often open it from one of the submodules, not the project root. So IDE does not see the node_modules/codelyzer folder from submodule's tslint.json. I have already tried:
1. tslint.json
{
"rulesDirectory": [
"../../node_modules/codelyzer"
]
}
2. tslint.json
{
"rulesDirectory": [
"./../../node_modules/codelyzer"
]
}
3. tslint.json
{
"extends": [
"./../../tslint-base.json"
]
}
4. tslint.json
{
"extends": [
"../../tslint-base.json"
]
}
And I also tried these in combinations. But it doesn't work...
What do I wrong?

Related

Tslint exclude doesn't work correctly, React-Dropzone

I have the following structure:
components
my_component
tslint.json
tslint.json
root tslint.json
{
"extends": ["...some/tslint.json"],
"linterOptions": {
"exclude": [
"components/**/node_modules/**/",
"components/**/node_modules/*",
"components/*/node_modules/",
"node_modules"
]
}
}
component tslint.json
{
"extends": ["../../tslint.json"],
"linterOptions": {
"exclude": [
"node_modules/**"
]
}
}
But when I run "lint": "tslint \"components/**/**.ts*\""
from the root, I get these errors:
ERROR: components/my_component/node_modules/react-dropzone/typings/tests/accept.tsx[78, 22]: ' should be "
ERROR: components/my_component/node_modules/react-dropzone/typings/tests/accept.tsx[78, 36]: ' should be "
...
It should've work even without local tslint.json
But I tried to override, and even this didn't help
How to make it work?

How to Debug other project than "main"?

Using Visual Studio Code, I have two directories in my workspace (both node.js projects), but I can only launch one of them. The launch.json file exists in both folders, but only the first is available in debug menu. The launch.json files looks like that:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}\\app.js",
"outFiles": [
"${workspaceFolder}/**/*.js"
]
}
]
}
How can I start debugging the second folder of my workspace?
I removed the first folder from the workspace, started the only project left, then added the removed folder again. Now I have both projects in the launch configurations.
I have found two solutions. Both involve editing your *.code-workspace file.
As OP found, you can reorder the folders. In the *.code-workspace file, place the folder with the desired launch.json at the top of the list of folders.
"folders": [
{
"path": "..\\ProjectWithLaunchJson"
},
{
"path": "..\\MyOtherProject"
}
]
Alternatively, you can include the launch configuration in the *.code-workspace file.
"folders": [
:
:
],
"settings": {
"launch": {
"configurations": [
{
<copy your launch.json's configuration into here>
}
]
}
}
YMMV. I had to tweak the path to the executable. And I had to remove the preLaunchTask property since VS Code could not find the Task. VS Code's support for this will likely evolve.

my-app.html missing from bundled build folder

I have a situation where I am using polymer starter-kit template for my app. My polymer.json files looks like this:
{
"entrypoint": "index.html",
"shell": "src/my-app.html",
"fragments": [
],
"sourceGlobs": [
"src/**/*",
"images/**/*",
"bower.json"
],
"includeDependencies": [
"manifest.json",
"bower_components/webcomponentsjs/webcomponents-lite.min.js"
]
}
When I build using polymer-cli command - 'polymer build', the bundled folder seems to miss the shell file 'my-app.html'.
If I remove
"shell": "src/my-app.html",
from the polymer.json file, the my-app.html file gets created in the bundled/src folder as it should but then the index.html file goes missing.
I am using the polymer-starter-kit template and adding files to it. I can't figure out why my-app.html or index.html goes missing depending on how polymer.json is configured.
Can you please tell me what's going wrong here?
Thank you.
I had the same problem with you yesterday and I added "/" at front of urls in polymer.json.
{
"entrypoint": "index.html",
"shell": "/src/my-app.html",
"fragments": [
"/src/my-app.html",
"/src/my-home.html",
"/src/my-shop.html"
],
"sourceGlobs": [
"src/**",
"src/**/*",
"src/structure/**/*",
"images/**/*",
"bower.json"
],
"includeDependencies": [
"manifest.json",
"bower_components/webcomponentsjs/webcomponents-lite.min.js"
]
}
I only added "/" at shell & fragments part and it worked.
I hope this can help.
Cheers.

ava: SyntaxError: Unexpected token import

So ava comes with build-in ES2015 support, which works fine for my actual test files. However, when I do
import {newUser, createUser, login} from './helpers/user';
I can't use import and export in the helper file, I then get:
Users/rowe/Code/fv/foxvision-api/test/api/helpers/user.js:1
(function (exports, require, module, __filename, __dirname) { import request from 'supertest';
SyntaxError: Unexpected token import
I have no specific babel configuration set up as for the test files it works out of the box. Can anyone explain to me why the helper dependencies are not transpiled with babel? Using test/**/helpers is even following ava convention.
Thanks,
Robin
Solution
So based on thangngoc89's solution, what I did to make it work was:
Add a .babelrc with content:
{
"presets": [
"es2015",
"stage-2"
],
"plugins": [
"espower",
"transform-runtime"
]
}
Added to package.json:
"ava": {
"require": ["babel-register"],
"babel": "inherit"
}
AVA only transpile the test files. Not test dependencies so you will need to setup babel in your project (I suppose you did it because you're using ES6 anyway).
Then in AVA's setting, add this :
"ava": {
...
"babel": "inherit"
}
It means that use your project babel setting to transpile the test dependencies. See more information in AVA docs: https://github.com/sindresorhus/ava/blob/master/docs/recipes/babelrc.md
Using rweng, my solution came out a bit simpler.
.babelrc
{
"presets": [
"es2015"
],
"plugins": [
"transform-runtime"
]
}
package.json:
"ava": {
"require": ["babel-register"],
"babel": "inherit"
}
Unfortunately standard solution didn't work for my case.
Here is my solution which worked for ava + quasar + vue project
.babelrc
{
"presets": [
"es2017",
"#ava/stage-4",
"stage-3"
],
"plugins": [
"transform-runtime"
]
}
package.json
"ava": {
"require": [
"babel-register"
],
"babel": "inherit"
},
"scripts": {
"ava": "NODE_ENV=test ava",
"test": "ava",
"test:watch": "ava --watch --verbose"
}
install modules
yarn add babel-register babel-preset-es2017 #ava/babel-preset-stage-4 babel-plugin-transform-runtime babel-preset-stage-3 --dev

hide certain hidden folders from my sublime project

How do I hide certain hidden folders that are nested 3 folders deep from my sublime project.
{
"folders":
[
{
"path": "/C/Users/me/Desktop/files/siteFiles/happy site/trunk"
},
{
"folder_exclude_patterns": ["myHiddenFolder",".svn", "._d", ".metadata", ".settings"]
}
]
}
You need to edit your .sublime-project file like so:
{
"folders":
[
{
"path": "/C/Users/me/Desktop/files/siteFiles/happy site/trunk",
"folder_exclude_patterns": ["myHiddenFolder",".svn", "._d", ".metadata", ".settings"]
}
]
}
Save the file, and you should be all set. For more info on project settings, check out the docs.