Skip to content

Commit f30a5f2

Browse files
committed
Migrate to ESLint 9 w/ flat config
Closes js-cookie#856
1 parent 2eca98a commit f30a5f2

File tree

7 files changed

+35
-20
lines changed

7 files changed

+35
-20
lines changed

.eslintignore

-1
This file was deleted.

.eslintrc.json

-13
This file was deleted.

eslint.config.mjs

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import globals from 'globals'
2+
import js from '@eslint/js'
3+
4+
const languageOptions = {
5+
globals: {
6+
...globals.browser
7+
}
8+
}
9+
export default [
10+
{
11+
ignores: ['dist/*']
12+
},
13+
{
14+
...js.configs.recommended,
15+
files: ['**/*.js'],
16+
ignores: ['examples/**/src/*.js'],
17+
languageOptions: {
18+
...languageOptions,
19+
sourceType: 'commonjs'
20+
}
21+
},
22+
{
23+
...js.configs.recommended,
24+
files: ['**/*.mjs'],
25+
languageOptions: {
26+
...languageOptions,
27+
ecmaVersion: 2021
28+
}
29+
}
30+
]

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
"test": "grunt test",
3131
"format": "prettier --write .",
3232
"format:check": "prettier --check .",
33-
"lint": "eslint --ext .js,.mjs --fix .",
34-
"lint:check": "eslint --ext .js,.mjs .",
33+
"lint": "eslint --fix .",
34+
"lint:check": "eslint .",
3535
"dist": "rm -rf dist/* && rollup -c",
3636
"release": "release-it"
3737
},
@@ -48,7 +48,7 @@
4848
"devDependencies": {
4949
"@rollup/plugin-terser": "^0.4.4",
5050
"browserstack-runner": "github:browserstack/browserstack-runner#1e85e559951bdf97ffe2a7c744ee67ca83589fde",
51-
"eslint": "^8.43.0",
51+
"eslint": "^9.0.0",
5252
"eslint-config-prettier": "^9.0.0",
5353
"eslint-plugin-html": "^8.0.0",
5454
"eslint-plugin-markdown": "^4.0.1",

src/api.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ function init(converter, defaultAttributes) {
6565
if (name === found) {
6666
break
6767
}
68-
} catch (e) {
68+
} catch {
6969
// Do nothing...
7070
}
7171
}

test/tests.js

-1
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,6 @@ QUnit.test('String primitive', function (assert) {
251251
})
252252

253253
QUnit.test('String object', function (assert) {
254-
// eslint-disable-next-line no-new-wrappers
255254
Cookies.set('c', new String('v'))
256255
assert.strictEqual(Cookies.get('c'), 'v', 'should write value')
257256
})

test/utils.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
)
5454
callback(result.value, iframeDocument.cookie)
5555
done()
56-
} catch (e) {
56+
} catch {
5757
// Do nothing...
5858
}
5959
})

0 commit comments

Comments
 (0)