The team is now working on the WordPress Interactivity API. This unblocks the same UX Frontity framework enabled but directly in WordPress Core, fully compatible with the new Site Editor.
This is a good moment to think again about our eslint and prettier configuration so it is as simple as possible.
Eslint
We were following eslint-airbnb in the past, but I’d like our configuration to be as simple and as standard as possible.
In the past, when prettier didn’t exist, eslint did a lot of syntax work. Nowadays much of the work is done by prettier, so I guess eslint is less important for syntax. It is still useful to catch errors (no undefined variables and stuff like that).
I’d like to start as simple as possible, then make things more complex only if we find there’s no other way.
Prettier
I’m thinking we could use prettier with the default config (no config file). Yes, I know, that means no trailing comma, no semis and double quotes
The main advantage I see is that if people don’t have prettier well configured, it still works. It also means they don’t need a file in their packages and it also means that it’s the same prettier config you get in codesandbox by default.
And I guess eslint and prettier should share the same rules, so one or the other has to adapt, right?
Also, in the previous Frontity we were using also eslint-plugin-import. Again, I think it was required by some other dependency, but don’t remember exactly which one, maybe airbnb.
[…] our editor team will be focusing on leveraging ESLint rather than duplicating work. For scenarios that ESLint currently doesn’t cover (e.g. semantic linting or program-wide linting), we’ll be working on sending contributions to bring ESLint’s TypeScript support to parity with TSLint. As an initial testbed of how this works in practice, we’ll be switching the TypeScript repository over to using ESLint, and sending any new rules upstream.
orballo9
There is a conflict between @typescript-eslint and prettier. Prettier will set an indentation of 2 spaces, while @typescript-eslint wants 4 spaces.
So we should add
"rules": {
"@typescript-eslint/indent": "off"
}
to our .eslintrc or change prettier config. What do you prefer?
luisherranz10
eslint because we already have a .eslintrc file and if not, we need to add a .prettierrc file just for that
luisherranz11
There’s a problem with our approach of not using a file for prettier: the vs-code extension uses the default settings each user has defined
So I guess we need to tell it to be quiet…
orballo12
I’ll have a look at it.
luisherranz13
The "prettier": {} line works fine.
orballo14
Do you prefer that line in package.json than {} in a .prettierrc file?