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: enable prefer-template rule #37484

Merged
merged 1 commit into from
Nov 12, 2022
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.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"error",
"after"
],
"prefer-template": "error",
"semi": [
"error",
"never"
Expand Down
2 changes: 1 addition & 1 deletion build/build-plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const { babel } = require('@rollup/plugin-babel')
const banner = require('./banner.js')

const sourcePath = path.resolve(__dirname, '../js/src/').replace(/\\/g, '/')
const jsFiles = globby.sync(sourcePath + '/**/*.js')
const jsFiles = globby.sync(`${sourcePath}/**/*.js`)

// Array which holds the resolved plugins
const resolvedPlugins = []
Expand Down
2 changes: 1 addition & 1 deletion js/src/util/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const TRANSITION_END = 'transitionend'
const parseSelector = selector => {
if (selector && window.CSS && window.CSS.escape) {
// document.querySelector needs escaping to handle IDs (html5+) containing for instance /
selector = selector.replace(/#([^\s"#']+)/g, (match, id) => '#' + CSS.escape(id))
selector = selector.replace(/#([^\s"#']+)/g, (match, id) => `#${CSS.escape(id)}`)
}

return selector
Expand Down
2 changes: 1 addition & 1 deletion js/tests/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ if (BROWSERSTACK) {
config.browserStack = {
username: ENV.BROWSER_STACK_USERNAME,
accessKey: ENV.BROWSER_STACK_ACCESS_KEY,
build: `bootstrap-${ENV.GITHUB_SHA ? ENV.GITHUB_SHA.slice(0, 7) + '-' : ''}${new Date().toISOString()}`,
build: `bootstrap-${ENV.GITHUB_SHA ? `${ENV.GITHUB_SHA.slice(0, 7)}-` : ''}${new Date().toISOString()}`,
project: 'Bootstrap',
retryLimit: 2
}
Expand Down
2 changes: 1 addition & 1 deletion js/tests/unit/collapse.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ describe('Collapse', () => {
const trigger2 = fixtureEl.querySelector('#trigger2')
const trigger3 = fixtureEl.querySelector('#trigger3')
const target1 = fixtureEl.querySelector('#test1')
const target2 = fixtureEl.querySelector('#' + CSS.escape('0/my/id'))
const target2 = fixtureEl.querySelector(`#${CSS.escape('0/my/id')}`)

const target2Shown = () => {
expect(trigger1).not.toHaveClass('collapsed')
Expand Down
2 changes: 1 addition & 1 deletion js/tests/unit/tab.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ describe('Tab', () => {
const tab = new Tab(profileTriggerEl)

profileTriggerEl.addEventListener('shown.bs.tab', () => {
expect(fixtureEl.querySelector('#' + CSS.escape('2'))).toHaveClass('active')
expect(fixtureEl.querySelector(`#${CSS.escape('2')}`)).toHaveClass('active')
done()
})

Expand Down
2 changes: 1 addition & 1 deletion js/tests/unit/util/config.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ describe('Config', () => {
const obj = new DummyConfigClass()
expect(() => {
obj._typeCheckConfig(config)
}).toThrowError(TypeError, obj.constructor.NAME.toUpperCase() + ': Option "parent" provided type "number" but expected type "(string|element)".')
}).toThrowError(TypeError, `${obj.constructor.NAME.toUpperCase()}: Option "parent" provided type "number" but expected type "(string|element)".`)
})

it('should return null stringified when null is passed', () => {
Expand Down
2 changes: 1 addition & 1 deletion js/tests/visual/carousel.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ <h1>Carousel <small>Bootstrap Visual Test</small></h1>
// Test to show that transition-duration can be changed with css
carousel.addEventListener('slid.bs.carousel', event => {
t1 = performance.now()
console.log('transition-duration took ' + (t1 - t0) + 'ms, slid at ' + event.timeStamp)
console.log(`transition-duration took ${t1 - t0}ms, slid at ${event.timeStamp}`)
})
carousel.addEventListener('slide.bs.carousel', () => {
t0 = performance.now()
Expand Down
2 changes: 1 addition & 1 deletion js/tests/visual/modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ <h1 class="modal-title fs-4" id="slowModalLabel">Lorem slowly</h1>

slowModal.addEventListener('shown.bs.modal', () => {
t1 = performance.now()
console.log('transition-duration took ' + (t1 - t0) + 'ms.')
console.log(`transition-duration took ${t1 - t0}ms.`)
})

slowModal.addEventListener('show.bs.modal', () => {
Expand Down