eslint rule or plugin to enforce filename to be the same as parent folder - eslint

I need to have the same filenames for .vue and .stories.ts files in my folder structure as the parent folder.
Here is an example of how I want to work for it:
src
components
MyButton
MyButton.vue
MyButton.stories.ts
Can eslint rule/plugin do that for me? If there is no such plugin/rule, does eslint have opportunity to work that way if I write a rule by myself?

Related

PhpStorm doesn't recognize package.json name of local directories

I'm using ReactNative and I have package.json in my local directories so I can have easier imports.
Example:
I have src/components folder and I want to import all components as :
import Button from 'components/Button;
and not use relative path as
import Button from '../../../components/Button;
I created package.json file in my components folder with name 'components' and now I can access Button component as needed.
But, there is problem with PhpStorm. PhpStorm doesn't recognize this as valid path. Is there any workaround for this?
This React native hack for specifying absolute paths (not officially documented anywhere, as far as I can tell) had never been supported. If you miss this feature, please follow WEB-23221 for updates. You can try creating a dummy webpack config like it's suggested in https://youtrack.jetbrains.com/issue/WEB-23221#focus=streamItem-27-2719626.0-0 and specifying a path to it in Settings | Languages & Frameworks | JavaScript | Webpack as a workaround.
Another workaround (if you aren't renaming paths, just making it shorter) is marking a parent folder of components directory as Resource root (note: not the subdirectory itself, but its parent dir!)

How to exclude files from outside my workspace from ESLint in VSCode?

When I'm in a workspace and open an external file (from outside of workspace) in VSCode, how can I exclude this file from lint? More specifically from pug-lint but the same applies to ESLint?
The thing is that I want to exclude all files from outside my project (workspace), as in: if ./ is my project root folder, I want to exclude everything out of this (.././). This happens if I'm working in a project and open some file from outside that project, and ESLint starts working on it and messaging me about lint errors...I would like to avoid this clutter.

Brunch build tool: subfolders in the assets directory are not copied?

i'm trying to set up my first project using Brunch, and i'm having a small issue, i want brunch to copy all files and subfolders in assets/ to the public/ folder, but it only copies the files and ignores the subfolders and other files.
And another thing is that i might like to have a folder called styles with subfolders for images and fonts, and i want them to be copied to the same place but in the public/ folder, is that possible?
here is an example:
app/
-assets/ html files, some xml files and ico's too
-styles/
-scss/
-img/
-fonts/
-scripts/
-vendor/ js and css files.
target folder:
public/ all files from assets
-styles css from scss folder, and a css for vendor's css
-img
-fonts
-js vendor and app js files
Thanks ahead!
Brunch only handles assets inside assets folders by default. You can also create app/styles/assets subdirectory.
If you want to change this default behavior, it's possible to change config.conventions.assets.

How do I use / utilise the Assets.json file in the Themes directory?

I am starting a new Theme from scratch and have a file called 'Assets.json' in the root directory.
It maps the LESS file from the 'Assets' directory to a CSS file in the 'Styles' directory - great.
Can anyone point me in the right direction as to how I can make use of this, as it's exactly what I want but can't find any information on how to use it.
Thanks!
The Assets.json file is a way to plug into the default gulp script that is provided with Orchard. This script is able to process .less files (and others) in order to generate minified and non-minified versions of scripts or stylesheets, and bundle your grouped assets. This way you don't have to create your own gulp file for each module, just describe the assets you want to be processed and it will do it automatically.
It will also watch the files you described and re-process them when they have changed. The simplest way to use them is to copy-paste one from the core modules, and place them in your own module or theme. Then just run the main gulp file, or enable its support in Visual Studio. You can run npm install from the root folder for this.

Custom 'themes' compilation possible using brunch?

I am trying to figure out how I can accomplish the following using brunch. This is the current directory structure for our app:
--app
--base (theme folder, considered the master for all themes)
--sass
--js
--theme2
--sass
--js
--theme3
--sass
--js
...so on
The base folder serves as a master for all other themes. However, if another theme has a file in the sass directory or js directory that matches one in the base folder it overrides that file in the base folder (this applies for imports as well).
I have so far created this which works the way it needs to but it circumvents the brunch pipeline in that I write out the files (doesn't currently support file concatenation) and I would prefer to do this using the proper brunch pipline.
What happens is that each sass or js file it encounters in the base folder is used to generate a new file for another theme. E.g say the base theme has a file called main.scss. The path passed to compile is base/scss/main.scss. Now I want to use this same file for the other themes so I get all the theme folders and dynamically use this base main.scss file for each of the other themes. However, I also alter the inner imports to substitute files imports if they exist in the other themes directory. Its not the same file being spat into multiple locations.
The problem is that I want to dynamically generate new CSS files for brunch to render to different folders not related to the original path passed in (and thus the joinTo config option for this path). By calling the callback, it automatically uses the original path parameter passed to the compile method.
Use overrides in your brunch-config to change your joinTos to include base plus the given theme. You can also customize the build output directory or anything else for each theme if that helps. Then run each build separately using a command like brunch build --env theme1.

Resources