contactlab / eslint-config-contactlab Goto Github PK
View Code? Open in Web Editor NEWContactlab ESLint extensible and sharable configuration.
Home Page: https://contactlab.github.io/eslint-config-contactlab
License: Apache License 2.0
Contactlab ESLint extensible and sharable configuration.
Home Page: https://contactlab.github.io/eslint-config-contactlab
License: Apache License 2.0
Nodejs v14 reached end-of-life on 2023-04-30 (rif.), so the support for this specific version can be dropped.
Node v12 is gone "end-of-life" so we can stop supporting it.
Meanwhile we can add Node v18 (next LTS) to the node-version
matrix in the GitHub Actions pipeline
typescript-eslint
package needs TypeScript in order to run: because eslint-config-contactlab
aims to be used also in non-TypeScript projects the available configuration has to be splitted in contactlab
and contactlab/typescript
and TypeScript itself should be set as peerDependency
A new major version (v6) of typescript-eslint
is now available.
The team reworked the configuration files names (the "recommended" ones) adding a slight distinction between "functional" and "stylistic" rules.
Thus, we should:
Be aware: this change will catch and notify many new errors in the code base for sure.
In order to mitigate this situation the no-unsafe- rules severity should be set to warn
Every time I create a TypeScript enum, Eslint says it had already been defined.
export enum MyEnum { // <-- got "already declared in the upper scope” error
myValueOne = 'myValue',
myValueTwo = 'myValueTwo',
}
Searching typescript-eslint GitHub issues shows several people asking the same thing.
The possible solution for the Typescript set of rules can be, accordingly to the typescript-eslint documentation, disable the no-shadow
basic rule and enable @typescript-eslint/no-shadow
.
...
"rules": {
"no-shadow": "off",
"@typescript-eslint/no-shadow": ["error"]
},
...
The official eslint-plugin-import
seems to have published a new version with the pathGroupsExcludedImportTypes
option for the import/order
submodule, so we can use it instead of our forked version
The configuration should be a combination of recommended
and:
fp-ts/no-module-imports
offfp-ts/no-redundant-flow
errorfp-ts/prefer-traverse
errorfp-ts/prefer-chain
errorfp-ts/prefer-bimap
errorUse greenkeeper-lockfile to make Greenkeeper work with project lockfiles.
The no-unused-vars
rule (and its Typescript counter part) has an ignoreRestSiblings
flag which avoids to mark sibling properties or "rest" properties as "unused".
We should consider to enable it by default
Drop support for node v4:
@/**
import should be handle as "external" (after them).
Wrong:
import * as React from 'react';
import * as Option from 'fp-ts/Option';
import {Component} from './index';
import * as Env from '@/Env/types';
Right:
import * as Option from 'fp-ts/Option';
import * as React from 'react';
import * as Env from '@/Env/types';
import {Component} from './index';
Since version 5.17.0 @typescript-eslint
supports the destructuredArrayIgnorePattern
option of no-unused-vars
rule.
So, we can add an "ignore pattern" for elements of destructured arrrays which start with _
(just like we did for functions parameters) in order to make legit things like:
const [_, someValue] = useSomeCustomHook();
if (someValue) {
// ...
}
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.