thenativeweb / eslint-config-es Goto Github PK
View Code? Open in Web Editor NEWeslint-config-es contains a strict ESLint configuration for ES2015+ and TypeScript.
License: MIT License
eslint-config-es contains a strict ESLint configuration for ES2015+ and TypeScript.
License: MIT License
Hi Golo,
your config causes linter warnings:
(node:21951) [ESLINT_LEGACY_OBJECT_REST_SPREAD] DeprecationWarning: The 'parserOptions.ecmaFeatures.experimentalObjectRestSpread' option is deprecated. Use 'parserOptions.ecmaVersion' instead. (found in "es/2015/client")
Ich verwende das Paket in einem Projekt mit Vue.js & TypeScript. IDE ist PHPStorm. Projekt hat keine Verbindung zu einem GitHub-Repository.
Unter Windows 10 erhalte ich die Fehlermeldungen, wenn ich den Befehl "npm run analyse" ausführe.
`export default interface Comment {
id: number;
body: string;
postId: number;
}
`
When using nested ternary operators (it is not nice, I know - but well), there are two rules:
no-extra-parens
and unicorn/no-nested-ternary
.
The former says not to put parenses around the second ternary, the latter say to do so.
E.g.:
// fullfills no-extra-parens
const withoutParens = first ? 'first' : second ? 'second' : 'third'
// Fulfills no-nested-ternary
const withParens = first ? 'first' : (second ? : 'second' : 'third');
Ich hab folgende Ergänzungswünsche der Readme zu diesem Paket.
.eslintrc.json
{ "root": true, "extends": [ "es/browser" ], "parserOptions": { "sourceType": "module" }, "rules": { "linebreak-style": "off", "@typescript-eslint/indent": "off", "class-methods-use-this": "off", "padded-blocks": "off" } }
scripts in package.json erweitern
"analyse": "eslint \"**/*.ts\" --ignore-path .eslintignore",
I have recently updated a few of our dependencies, but did not adjust the rules. The updated packages were:
| name | from version | to version |
| eslint-plugin-react | 7.24.0 | 7.26.1 |
| @typescript-eslint/eslint-plugin | 4.29.2 | 5.2.0 |
| @typescript-eslint/parser | 4.33.0 | 5.2.0 |
The breaking changes did not affect us. We still need to look over the changes in these packages and adjust our rules.
Error: .eslintrc.cjs » eslint-config-es/node:
Configuration for rule "unicorn/explicit-length-check" is invalid:
Value {"nonZero":"greaterThan","non-zero":"greater-than"} should NOT have additional properties.
is showing with [email protected] and later (current is 42.0.0).
package.json:
{
"name": "test",
"version": "1.0.0",
"description": "",
"type": "module",
"main": "test.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"eslint": "8.18.0",
"eslint-config-es": "4.2.0",
"eslint-plugin-eslint-comments": "3.2.0",
"eslint-plugin-extended": "0.2.0",
"eslint-plugin-import": "2.26.0",
"eslint-plugin-mocha": "10.0.5",
"eslint-plugin-unicorn": "42.0.0"
}
}
.eslintrc.cjs:
module.exports = {
extends: [
'es/node'
],
parserOptions: {
sourceType: 'module'
},
rules: {
}
}
eslint test.js
results in the error
Error: .eslintrc.cjs » eslint-config-es/node:
Configuration for rule "unicorn/explicit-length-check" is invalid:
Value {"nonZero":"greaterThan","non-zero":"greater-than"} should NOT have additional properties.
and it's not possible to even disable that rule by:
rules: {
'unicorn/explicit-length-check': 0
}
I guess you need to update this rule in eslint-config-es
Starting with eslint-config-es v4 it's not sufficient to install only eslint and eslint-config-es in yarn projects anymore. In addition all peerDependencies need to be added explicitly. To my understanding the reason is the different handling of peerDependencies between yarn and npm, version 3 did work for yarn and npm because it did not use peerDependencies.
Could the peer dependencies be moved back to to make the plugin work with yarn again or are there any downsides I'm not aware of?
Example install output:
yarn install v1.22.17
warning package.json: No license field
warning [email protected]: No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning " > [email protected]" has unmet peer dependency "@typescript-eslint/[email protected]".
warning " > [email protected]" has unmet peer dependency "@typescript-eslint/[email protected]".
warning " > [email protected]" has unmet peer dependency "[email protected]".
warning " > [email protected]" has unmet peer dependency "[email protected]".
warning " > [email protected]" has unmet peer dependency "[email protected]".
warning " > [email protected]" has unmet peer dependency "[email protected]".
warning " > [email protected]" has unmet peer dependency "[email protected]".
package.json used:
{
"name": "eslint-deps",
"version": "0.1.0",
"dependencies": {
"eslint-config-es": "^4.1.0",
"eslint": "^8.8.0",
"typescript": "^4.5.5"
}
}
Downgrading to version 3 works for both yarn and npm, example:
{
"name": "eslint-deps",
"version": "0.1.0",
"dependencies": {
"eslint": "^7.32.0",
"eslint-config-es": "^3.31.0",
"typescript": "^4.5.5"
}
}
👋🏻 Hey,
I just realized that the very awesome plugin eslint-plugin-react-hooks is not part of this package yet. I think it is super helpful - and especially for people new to react,this can avoid serious hooks-issues.
Are you interested in packaging this up here?
If so, I'd be happy to put up an PR. 🙂
Hey guys :)
latest version 0.8.5 doesn't work on node 4.6.0, which is the current LTS version. It's caused by the array prototype function call includes
in lines 289, 293 and 312. This is not supported in node 4.6.0.
Would you mind changing this to support older node versions? I would suggest adding an polyfill or just using old fashioned indexOf
call.
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.