Comments (9)
Just to be clear, the reason I don't like Neutrino creating files is it just enforces repo boilerplate over presets. Project maintainers can add those files if they wish, but it is outside of the scope of Neutrino to create these files.
from neutrino.
So, I'm really against the creation of files in a repo, at least from the perspective of Neutrino creating them. Using the Neutrino API should be easy enough, although it doesn't really eliminate the boilerplate of getting the presets.
// .eslintrc.js
const Neutrino = require('neutrino');
const pkg = require('./package.json');
const api = new Neutrino(pkg.config.presets);
module.exports = api.module.rule('lint').loaders.get('eslint').options;
Unfortunately, the ESLint RC file format is different than the config passed to an instance of ESLint's CLIEngine (and therefore eslint-loader), so it isn't just as simple as exporting the same config. 😞
from neutrino.
Yes, project maintainer can add those files by hand. But better to build some scripts to generator these files. How about creating a new project like neutrino-utils-genconfig
?
I'll do that later, tired of copy configs every time when starting a new project.
from neutrino.
Yes, I think that will work just fine for an external project.
By the way, I just had a thought. Maybe it should be the responsibility of the lint preset to also allow an export of its configuration consumable as an RC file. Then the preset would do the necessary conversion to allow it to be read as by ESLint's CLIEngine. Basically, it would enable you to do:
module.exports = require('neutrino-preset-airbnb-base/eslint');
EDIT: Hmm, I clearly hadn't thought that all the way through. That approach wouldn't work for the merging of lint configuration between presets. It would only get you the lint config from the base preset. I think my comment above still presents the best solution at the moment.
from neutrino.
Hi.
I have such interesting problem:
Neutrino says that I have style errors.
I open my IDE and hit "reformat code" and it does reformat according to internal defaults.
Everything is fine, but neutrino still see the problem.
Currently there are 2 places for eslint presets and most of IDEs respect them.
In neutrino-preset-airbnb-base
it's supposed that configuration overrides should be put into config.neutrino.module.rule.lint.loader.eslint.options
and this location will not be checked by IDEs.
IDEs don't expect that there are some style rules deep inside neutrino presets too.
So.. To fix this problem, I need this .eslintrc file.
I could fill it by hands, but then I need to sync my eslintrc file with all neutrino preset updates.
I could use internal api (api.getWebpackOptions().module.rules[0].use[0].options
). But what if these indexes (0-s) will change after adding some other plugin?
Another problem is that such styling plugins could have deep dependency tree with overrides and it will be too hard to find out real styles used in my project.
From my point of view.. I'll have more problems using this preset than just running eslint directly.
I like this idea with one universal build/run tool for node projects. But It would be better if it will be compatible with existing tools.
I'd suggest you to createneutrino-preset-eslint
which will just parse eslint config from package.json or from rc file?
If you need some custom preset for neutrino, you can publish it as another eslint preset. and include it into package.json uder eslintConfig namespace.
from neutrino.
@akaRem would this work for you? Just create a file in the root of your project named .eslintrc.js
and use this as the contents:
// .eslintrc.js
const Neutrino = require('neutrino');
const pkg = require('./package.json');
const api = new Neutrino(pkg.config.presets);
module.exports = api.module.rules.get('lint').loaders.get('eslint').options;
from neutrino.
Just had a thought, maybe I could expose this on neutrino.custom
from the lint base. Something like:
api.custom.lintConfig();
which will re-format the object to something usable by an ESLint rc format.
from neutrino.
Released lint presets with a new method: api.custom.eslintrc()
, in v4.3.0. Documented:
https://neutrino.js.org/presets/neutrino-lint-base/#eslintrc-config
Thanks!
from neutrino.
@eliperelman looks nice and much more useful! Thanks.
from neutrino.
Related Issues (20)
- Issue: alias and config externals HOT 3
- Webpack 5 support HOT 5
- Tests fail because of CRLF-LF HOT 4
- Switch from eslint-loader to eslint-webpack-plugin HOT 3
- Optional chaining doesn't work out of the box HOT 2
- Allow specifying karma files option without removing the tests file specification neutrino use HOT 1
- Cannot use same babel plugin multiple times HOT 2
- Jest: custom moduleNameMapper entries should have priority
- rollup HOT 3
- Prettier breaks Neutrino webpack chain indent style HOT 1
- OTF fonts not supported by font-loader middleware HOT 3
- Updating React to v17 HOT 2
- nodejs build doesn't includes dependencies HOT 1
- Dependency Dashboard
- Alternative output without deleting other files HOT 1
- Support webpack-dev-server v4 HOT 3
- Build library for the browser HOT 1
- fullScreen make the app crash on armhf HOT 1
- Npm start failed to launch the project ! HOT 2
- Neutrino still under development? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from neutrino.