Skip to content

Commit 9c4222d

Browse files
authored
Prepare Prettier config (#1347)
* Update prettier to latest * Update prettier config, turn into esm * Add prettier scripts * Format one file for testing * Add test/fixtures to prettier ignore to preserve sourcemaps for testing
1 parent 3287684 commit 9c4222d

File tree

5 files changed

+20
-12
lines changed

5 files changed

+20
-12
lines changed

.prettierignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,7 @@ vendor
1717
# 2. some tests fail cause they depend on some sources being exactly as they are
1818
examples
1919
!test/examples
20+
21+
# Test fixtures include compiled/generated files with sourcemaps
22+
# Formatting them breaks the sourcemaps
23+
test/fixtures

eslint.config.mjs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,20 @@ export default defineConfig([
1414
},
1515
rules: {
1616
'comma-dangle': 'off',
17-
'strict': 0,
17+
strict: 0,
1818
'no-underscore-dangle': 0,
1919
'no-useless-escape': 0,
20-
'complexity': [2, { 'max': 35 }],
21-
'no-use-before-define': [0, { 'functions': false }],
20+
complexity: [2, { max: 35 }],
21+
'no-use-before-define': [0, { functions: false }],
2222
'no-prototype-builtins': 0,
2323

2424
// Off until issues are fixed
25-
'camelcase': 'off', //[2, {'properties': 'never'}],
25+
camelcase: 'off', //[2, {'properties': 'never'}],
2626
'no-unused-vars': 'off', //[2, { 'argsIgnorePattern': '^_' }],
27-
'quotes': 'off', //[2, 'single', 'avoid-escape'],
28-
}
27+
quotes: 'off', //[2, 'single', 'avoid-escape'],
28+
},
2929
},
3030
{
3131
ignores: ['dist', 'examples', 'node_modules', 'vendor'],
32-
}
32+
},
3333
]);

package-lock.json

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
"mocha": "^11.1.0",
9999
"nock": "^11.9.1",
100100
"node-libs-browser": "^0.5.2",
101-
"prettier": "^3.2.5",
101+
"prettier": "^3.6.2",
102102
"sinon": "^8.1.1",
103103
"webpack": "^5.98.0",
104104
"webpack-cli": "^6.0.1",
@@ -114,6 +114,8 @@
114114
"test:wtr": "web-test-runner",
115115
"test:wtr:watch": "web-test-runner --watch",
116116
"lint": "./node_modules/.bin/eslint .",
117+
"format": "prettier --write \"**/*.{js,cjs,mjs,md,json,yml,yaml}\"",
118+
"format:check": "prettier --check \"**/*.{js,cjs,mjs,md,json,yml,yaml}\"",
117119
"pack": "node scripts/pack.js",
118120
"validate": "npm run validate:es5 && npm run validate:examples",
119121
"validate:es5": "es-check es5 './dist/**/*.js' --verbose",
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
// https://prettier.io/docs/en/options.html
12
/**
23
* @type {import('prettier').Config}
34
*/
4-
module.exports = {
5-
trailingComma: 'all',
5+
export default {
66
singleQuote: true,
77
};

0 commit comments

Comments
 (0)