Thanks to visit codestin.com
Credit goes to github.com

Skip to content

chore: enable logical-assignment-operators rule internally #7484

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ module.exports = {
null: 'never',
},
],
'logical-assignment-operators': 'error',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Praise] 👌 and it even respects the existing alphabetical order of rules!!

'no-else-return': 'error',
'no-mixed-operators': 'error',
'no-console': 'error',
Expand Down
17 changes: 8 additions & 9 deletions packages/eslint-plugin/src/rules/consistent-type-imports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,14 @@ export default util.createRule<Options, MessageIds>({
ImportDeclaration(node): void {
const source = node.source.value;
// sourceImports is the object containing all the specifics for a particular import source, type or value
const sourceImports =
sourceImportsMap[source] ??
(sourceImportsMap[source] = {
source,
reportValueImports: [], // if there is a mismatch where type importKind but value specifiers
typeOnlyNamedImport: null, // if only type imports
valueOnlyNamedImport: null, // if only value imports with named specifiers
valueImport: null, // if only value imports
});
sourceImportsMap[source] ??= {
source,
reportValueImports: [], // if there is a mismatch where type importKind but value specifiers
typeOnlyNamedImport: null, // if only type imports
valueOnlyNamedImport: null, // if only value imports with named specifiers
valueImport: null, // if only value imports
};
const sourceImports = sourceImportsMap[source];
if (node.importKind === 'type') {
if (
!sourceImports.typeOnlyNamedImport &&
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin/src/rules/unified-signatures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ export default util.createRule<Options, MessageIds>({
key?: string,
containingNode?: ContainingNode,
): void {
key = key ?? getOverloadKey(signature);
key ??= getOverloadKey(signature);
if (
currentScope &&
(containingNode || signature).parent === currentScope.parent
Expand Down
2 changes: 1 addition & 1 deletion packages/rule-tester/src/utils/config-validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ function validateConfigSchema(
config: TesterConfigWithDefaults,
source: string,
): void {
validateSchema = validateSchema || ajv.compile(configSchema);
validateSchema ||= ajv.compile(configSchema);

if (!validateSchema(config)) {
throw new Error(
Expand Down
7 changes: 3 additions & 4 deletions packages/scope-manager/src/referencer/ClassVisitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,9 @@ class ClassVisitor extends Visitor {
* ) {}
* }
*/
withMethodDecorators =
withMethodDecorators ||
(methodNode.kind !== 'set' &&
node.params.some(param => param.decorators.length));
withMethodDecorators ||=
methodNode.kind !== 'set' &&
node.params.some(param => param.decorators.length);
if (!withMethodDecorators && methodNode.kind === 'set') {
const keyName = getLiteralMethodKeyName(methodNode);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,7 @@ function getWatchProgramsForProjects(
if (fileList.has(filePath)) {
log('Found existing program for file. %s', filePath);

updatedProgram =
updatedProgram ?? existingWatch.getProgram().getProgram();
updatedProgram ??= existingWatch.getProgram().getProgram();
// sets parent pointers in source files
updatedProgram.getTypeChecker();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function ConfigTypeScript(props: ConfigTypeScriptProps): React.JSX.Element {
getTypescriptOptions().reduce<Record<string, ConfigOptionsType>>(
(group, item) => {
const category = item.category!.message;
group[category] = group[category] ?? {
group[category] ??= {
heading: category,
fields: [],
};
Expand Down