Why not ¯\_(ツ)_/¯
theodoreb / eslint-config-drupal Goto Github PK
View Code? Open in Web Editor NEWDrupal eslint configuration
Drupal eslint configuration
Why not ¯\_(ツ)_/¯
Drupal updated their js eslint config drupal/drupal@ca9e520
I'm configuring ESLint form my custom Drupal theme and I want to use the same configuration as in Drupal core. This package is really helpful for that, but it depends on "eslint-config-airbnb" and it requires the installation of 'eslint-plugin-jsx-a11y', 'eslint-plugin-react', 'eslint-plugin-react-hooks'
Is it really necessary to use the package "eslint-config-airbnb" or is it possible to replace it with "eslint-config-airbnb-base", which doesn't require the the above mentioned dependencies?
How to configure the code editor correctly
First, this is not a problem, it is a question about the correct use of standards in an IDE integrated development environment.
I found myself trying to configure eslint for Drupal in PHPStorm, and it really is confusing.
ESLint Standards
For example, I have installed the node dependencies that comes in the web / core / package.json file
In PHPStorm in the Eslint settings I have configured,
web/core/node_modules/eslint
, but with this module (eslint-config-drupal)
, I don't know if to configure it with node_modules/eslint
which is in the root where I installed eslint-config-drupal
. The same goes for prettier.
When I check the Drupal Js code standards using for example the command:
$[web/core] ./node_modules/.bin/eslint --no-ignore "../modules/custom/my_module/js/file.js"
As you can see I had to pass the --no-ignore
argument in order to see the style errors.
The package.json that brings the drupal core has some interesting commands that I am interested in using, such as transpiling ES6 to ES5, what the core does is transpile a file called file.es6.js
to file.js
in it. same place that the file is located.
In the drupal documentation I see that the command can be used apparently like this:
$[web/core] npm run build:js -- --file ../modules/custom/my_module/js/file.es6.js
But when doing it, I notice that the babel plugins do not process them and only show the same file, I only add a generic header text.
I understand that these commands are for the Drupal core, and if I temporarily copy my file.es6.js
file to a location within the core, node with babel transpiles it correctly.
The only way that I have managed to transpile it is to copy the package.json
, the core JS scripts, and use it in the root of the project. What I don't like is having everything duplicated.
I don't know if there is a way to use the standards, scripts, etc. that come from the core in a transparent way.
I have created a question in:
Configure JS standards correctly in Drupal
Greetings.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.