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

ESLint: Require 'use strict' header #5334

Draft
wants to merge 1 commit into
base: watson/enable-eslint-plugin-n
Choose a base branch
from
Draft
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions benchmark/e2e/express-helloworld-manyroutes/app.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const crypto = require('crypto')
const app = require('express')()

Expand Down
2 changes: 2 additions & 0 deletions benchmark/sirun/appsec-iast/insecure-bank.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const http = require('http')
const app = require('/opt/insecure-bank-js/app') // eslint-disable-line import/no-absolute-path

Expand Down
2 changes: 2 additions & 0 deletions benchmark/sirun/appsec/insecure-bank.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const http = require('http')
const app = require('/opt/insecure-bank-js/app') // eslint-disable-line import/no-absolute-path

Expand Down
2 changes: 2 additions & 0 deletions benchmark/sirun/encoding/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const {
ENCODER_VERSION
} = process.env
Expand Down
2 changes: 2 additions & 0 deletions benchmark/sirun/gc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const { createHistogram, PerformanceObserver } = require('perf_hooks')
if (createHistogram) {
const StatsD = require('./statsd')
Expand Down
2 changes: 2 additions & 0 deletions benchmark/sirun/scope/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const {
DD_TRACE_SCOPE,
COUNT
Expand Down
2 changes: 2 additions & 0 deletions benchmark/sirun/spans/spans.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const tracer = require('../../..').init()

tracer._tracer._processor.process = function process (span) {
Expand Down
1 change: 1 addition & 0 deletions benchmark/sirun/strip-unwanted-results.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env node
'use strict'

const fs = require('fs')
const path = require('path')
Expand Down
2 changes: 2 additions & 0 deletions ci/cypress/after-run.js
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
'use strict'

module.exports = require('../../packages/datadog-plugin-cypress/src/after-run')
2 changes: 2 additions & 0 deletions ci/cypress/after-spec.js
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
'use strict'

module.exports = require('../../packages/datadog-plugin-cypress/src/after-spec')
2 changes: 2 additions & 0 deletions ci/cypress/plugin.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

require('../init')

module.exports = require('../../packages/datadog-plugin-cypress/src/plugin')
2 changes: 2 additions & 0 deletions ci/cypress/support.js
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
'use strict'

require('../../packages/datadog-plugin-cypress/src/support')
2 changes: 2 additions & 0 deletions ci/init.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

/* eslint-disable no-console */
const tracer = require('../packages/dd-trace')
const { isTrue, isFalse } = require('../packages/dd-trace/src/util')
Expand Down
3 changes: 2 additions & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ export default [
'no-prototype-builtins': 'off', // Override (turned on by @eslint/js/recommnded)
'no-unused-expressions': 'off', // Override (turned on by standard)
'no-var': 'error', // Override (set to warn in standard)
'require-await': 'error'
'require-await': 'error',
strict: 'error'
}
},
{
Expand Down
2 changes: 0 additions & 2 deletions integration-tests/appsec/esm-app/custom-noop-hooks.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict'

function dummyOperation (a) {
return a + 'should have ' + 'dummy operation to be rewritten' + ' without crashing'
}
Expand Down
1 change: 0 additions & 1 deletion integration-tests/appsec/esm-app/index.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
'use strict'
/* eslint n/no-unsupported-features/node-builtins: ['error', { ignores: ['module.register'] }] */

import childProcess from 'node:child_process'
Expand Down
2 changes: 0 additions & 2 deletions integration-tests/appsec/esm-app/worker-dep.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict'

function dummyOperation (a) {
return a + 'dummy operation with concat in worker-dep'
}
Expand Down
1 change: 1 addition & 0 deletions integration-tests/appsec/multer.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
'use strict'

/* eslint n/no-unsupported-features/node-builtins: ['error', { allowExperimental: true }] */

const { assert } = require('chai')
Expand Down
2 changes: 2 additions & 0 deletions integration-tests/ci-visibility-intake.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const express = require('express')
const bodyParser = require('body-parser')
const msgpack = require('@msgpack/msgpack')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const { createLogger, format, transports } = require('winston')

module.exports = createLogger({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const { expect } = require('chai')
const { When, Then } = require('@cucumber/cucumber')

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const logger = require('./logger')

module.exports = function (a, b) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const { expect } = require('chai')

const logger = require('./logger')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

module.exports = {
projects: [],
testPathIgnorePatterns: ['/node_modules/'],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const { createLogger, format, transports } = require('winston')

module.exports = createLogger({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const logger = require('./logger')

module.exports = function (a, b) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

module.exports = function (a, b) {
const localVariable = 2
if (a > 10) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const sum = require('./dependency')
const { expect } = require('chai')

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const sum = require('./dependency')
const { expect } = require('chai')

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const assert = require('assert')
const { When, Then } = require('@cucumber/cucumber')
const sum = require('./sum')
Expand Down
2 changes: 2 additions & 0 deletions integration-tests/ci-visibility/features-di/support/sum.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

function funSum (a, b) {
const localVariable = 2
if (a > 10) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const assert = require('assert')
const { When, Then } = require('@cucumber/cucumber')

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const assert = require('assert')
const { When, Then } = require('@cucumber/cucumber')

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const { expect } = require('chai')
const { By, Builder } = require('selenium-webdriver')
const chrome = require('selenium-webdriver/chrome')
Expand Down
2 changes: 2 additions & 0 deletions integration-tests/ci-visibility/features/support/steps.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const assert = require('assert')
const { When, Then, Before } = require('@cucumber/cucumber')
class Greeter {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const Sequencer = require('@jest/test-sequencer').default

// From example in https://jestjs.io/docs/configuration#testsequencer-string
Expand Down
2 changes: 2 additions & 0 deletions integration-tests/ci-visibility/jest-flaky/flaky-fails.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

describe('test-flaky-test-retries', () => {
it('can retry failed tests', () => {
expect(1).toEqual(2)
Expand Down
2 changes: 2 additions & 0 deletions integration-tests/ci-visibility/jest-flaky/flaky-passes.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

let counter = 0

describe('test-flaky-test-retries', () => {
Expand Down
2 changes: 2 additions & 0 deletions integration-tests/ci-visibility/jestEnvironmentBadInit.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

require('dd-trace').init({
service: 'dd-trace-bad-init'
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

require('office-addin-mock')

function sum (a, b) {
Expand Down
2 changes: 2 additions & 0 deletions integration-tests/ci-visibility/office-addin-mock/test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const sum = require('./dependency')
const { expect } = require('chai')

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const { test, expect } = require('@playwright/test')

test.beforeEach(async ({ page }) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const { test, expect } = require('@playwright/test')

test.beforeEach(async ({ page }) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const { test, expect } = require('@playwright/test')

test.beforeEach(async ({ page }) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const { test, expect } = require('@playwright/test')

test.beforeEach(async ({ page }) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const { test, expect } = require('@playwright/test')

test.beforeEach(async ({ page }) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const { test, expect } = require('@playwright/test')

test.beforeEach(async ({ page }) => {
Expand Down
2 changes: 2 additions & 0 deletions integration-tests/ci-visibility/run-jest-bad-init.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const jest = require('jest')

const options = {
Expand Down
2 changes: 2 additions & 0 deletions integration-tests/ci-visibility/run-jest.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const jest = require('jest')

const options = {
Expand Down
2 changes: 2 additions & 0 deletions integration-tests/ci-visibility/run-mocha.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const Mocha = require('mocha')

const mocha = new Mocha({
Expand Down
2 changes: 2 additions & 0 deletions integration-tests/ci-visibility/run-workerpool.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const workerpool = require('workerpool')
const pool = workerpool.pool({ workerType: 'process' })

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const { expect } = require('chai')

describe('sharding test 1', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const { expect } = require('chai')

describe('sharding test 2', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const { expect } = require('chai')

describe('sharding test 3', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const { expect } = require('chai')

describe('sharding test 4', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const { expect } = require('chai')

describe('sharding test 5', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

module.exports = {
defaultCommandTimeout: 100,
e2e: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
'use strict'

module.exports = require('dd-trace/ci/cypress/plugin')
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
'use strict'

require('dd-trace/ci/cypress/support')
2 changes: 2 additions & 0 deletions integration-tests/ci-visibility/subproject/dependency.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

module.exports = function (a, b) {
return a + b
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const assert = require('assert')
const { When, Then } = require('@cucumber/cucumber')
class Greeter {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const { test, expect } = require('@playwright/test')

test.beforeEach(async ({ page }) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

// Playwright config file for integration tests
const { devices } = require('@playwright/test')

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const dependency = require('./dependency')

describe('subproject-test', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

describe('test', () => {
it('can do snapshot', () => {
expect(1 + 2).toMatchSnapshot()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const { expect } = require('chai')
const forEach = require('mocha-each')

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const { expect } = require('chai')

let globalCounter = 0
Expand Down
Loading
Loading