Skip to content

Commit

Permalink
Recognise .cjs files as containing jsx (gucong3000#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
BPScott authored and gucong3000 committed Jan 6, 2020
1 parent 5842fb9 commit 0bca5a4
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const syntax = require('postcss-syntax')({
extract: 'markdown',
},
{
test: /\.(?:m?[jt]sx?|es\d*|pac)$/i,
test: /\.(?:[cm]?[jt]sx?|es\d*|pac)$/i,
extract: 'jsx',
},
{
Expand Down
2 changes: 1 addition & 1 deletion get-lang.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const extracts = {
// https://github.com/Microsoft/vscode/blob/master/extensions/javascript/package.json
// https://github.com/Microsoft/vscode/blob/master/extensions/typescript-basics/package.json
// https://github.com/michaelgmcd/vscode-language-babel/blob/master/package.json
jsx: /^(?:m?[jt]sx?|es\d*|pac|babel|flow)$/i,
jsx: /^(?:[cm]?[jt]sx?|es\d*|pac|babel|flow)$/i,
// *.*html? HTML https://github.com/Microsoft/vscode/blob/master/extensions/html/package.json
// *.xslt? XSLT https://msdn.microsoft.com/en-us/library/ms764661(v=vs.85).aspx
// *.vue VUE https://vue-loader.vuejs.org/spec.html
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
".js",
".es6",
".mjs",
".cjs",
".pac",
".jsx",
".ts",
Expand Down
3 changes: 2 additions & 1 deletion test/languages.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,12 @@ describe("language tests", () => {
]);

testcase("jsx", [
// https://github.com/michaelgmcd/vscode-language-babel/blob/master/package.json
// https://github.com/Microsoft/vscode/blob/master/extensions/javascript/package.json
// javascript
".js",
".es6",
".mjs",
".cjs",
".pac",
// javascriptreact
".jsx",
Expand Down

0 comments on commit 0bca5a4

Please sign in to comment.