Skip to content
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

require-atomic-updates false positive #12621

Closed
aliclark opened this issue Nov 29, 2019 · 1 comment
Closed

require-atomic-updates false positive #12621

aliclark opened this issue Nov 29, 2019 · 1 comment
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly rule Relates to ESLint's core rules

Comments

@aliclark
Copy link

Tell us about your environment

Node version: v10.16.3
npm version: v6.9.0
Local ESLint version: v6.7.1 (Currently used)
Global ESLint version: Not found

What parser (default, Babel-ESLint, etc.) are you using?

default

Please show your full configuration:

Configuration
module.exports = {
	'root': true,
	'parserOptions': {
		'ecmaVersion': 2018
	},
	'plugins': [
		'prettier',
		'jest'
	],
	'extends': [
		'eslint:recommended',
		'plugin:jest/recommended',
		'prettier',
	],
	'env': {
		'es6': true,
		'node': true,
		'jest': true
	},
	'globals': {
		'module': true
	},
	'rules': {
		'no-var': 'error',
		'no-console': 'error',
		'no-empty': ['error'],
		'dot-notation': 'error',
		'prefer-const': 'error',
		'prefer-spread': 'error',
		'no-delete-var': 'error',
		'prefer-reflect': 'error',
		'max-len': ['error', 140],
		'space-infix-ops': 'error',
		'prefer-template': 'error',
		'indent': ['error', 'tab'],
		'no-extra-parens': 'error',
		'no-return-await': 'error',
		'no-useless-call': 'error',
		'semi': ['error', 'always'],
		'func-call-spacing': 'error',
		'no-useless-concat': 'error',
		'no-useless-rename': 'error',
		'prettier/prettier': 'error',
		'no-trailing-spaces': 'error',
		'prefer-destructuring': 'error',
		'eol-last': ['error', 'always'],
		'comma-style': ['error', 'last'],
		'comma-dangle': ['error', 'never'],
		'arrow-parens': ['error', 'always'],
		'space-in-parens': ['error', 'never'],
		'spaced-comment': ['error', 'always'],
		'dot-location': ['error', 'property'],
		'no-cond-assign': ['error', 'always'],
		'no-template-curly-in-string': 'error',
		'object-shorthand': ['error', 'always'],
		'operator-linebreak': ['error', 'before'],
		'space-before-blocks': ['error', 'always'],
		'object-curly-spacing': ['error', 'always'],
		'array-bracket-spacing': ['error', 'never'],
		'space-before-function-paren': ['error', 'never'],
		'no-multiple-empty-lines': ['error', { 'max': 1 }],
		'camelcase': ['error', { 'properties': 'always' }],
		'quotes': ['error', 'single', { 'avoidEscape': true }],
		'prefer-arrow-callback': ['error', {
			'allowUnboundThis': false
		}],
		'one-var': ['error', {
			'uninitialized': 'always',
			'initialized': 'never'
		}],
		'new-cap': ['error', {
			'capIsNewExceptions': ['A']
		}],
		'key-spacing': ['error', {
			'beforeColon': false,
			'afterColon': true
		}],
		'semi-spacing': ['error', {
			'before': false,
			'after': true
		}],
		'comma-spacing': ['error', {
			'before': false,
			'after': true
		}],
		'keyword-spacing': ['error', {
			'overrides': {
				'catch': {
					'after': false
				}
			}
		}],
		'space-unary-ops': ['error', {
			'words': false,
			'nonwords': false
		}],
		'no-constant-condition': ['error', {
			'checkLoops': false
		}],
		'generator-star-spacing': ['error', {
			'before': false,
			'after': true
		}],
		'max-statements-per-line': ['error', {
			'max': 2
		}],
		'brace-style': ['error', 'stroustrup', {
			'allowSingleLine': true
		}]
	}
};

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

	value = value || query && await Model.queryOne(query).exec();

	// also doesn't work:

	if (!value && query) {
		const z = await Model.queryOne(query).exec();
		value = z;
	}
npx eslint ./src/**

What did you expect to happen?

Expected that no warnings would be emitted

What actually happened? Please include the actual, raw output from ESLint.

src/api/upsert.js
  23:2  error  Possible race condition: `value` might be reassigned based on an outdated value of `value`  require-atomic-updates

This error is flagged on the assignment line value = ... in both cases.

@eslint-deprecated eslint-deprecated bot added the triage An ESLint team member will look at this issue soon label Nov 29, 2019
@aladdin-add aladdin-add added accepted There is consensus among the team that this change meets the criteria for inclusion bug ESLint is working incorrectly rule Relates to ESLint's core rules and removed triage An ESLint team member will look at this issue soon labels Nov 30, 2019
@aladdin-add
Copy link
Member

Duplicate of #11899 #11954 #11900

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators May 30, 2020
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label May 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly rule Relates to ESLint's core rules
Projects
None yet
Development

No branches or pull requests

2 participants