Skip to content

Commit

Permalink
Migrating to ECMAScript modules (#894)
Browse files Browse the repository at this point in the history
* ESM configs

* binary operators printers to ESM

* nodes to ESM

* common utilities to ESM

* comments to ESM

* main files to ESM

* test configuration to ESM

* format tests to new config

* unit tests to ESM

* prettier 2.8.8 is incompatible with ESM so only running standalone tests

* cleanup: dir-to-object doesn't work with ESM

* updating dependencies compatible with ESM

* fixing lint

* testing prettier-version on cjs and esm

* adding conditional exports for environments using cjs or prettier v2

* using cache strategy to load solc and improving testing times

* updating `parse` signature for standalone tests

* Include the whole dist/ directory when publishing

* since we are publishing the whole `dist` folder, we make sure to clean it before building

---------

Co-authored-by: Franco Victorio <[email protected]>
  • Loading branch information
Janther and fvictorio authored Aug 21, 2023
1 parent aa9c822 commit 326ddfb
Show file tree
Hide file tree
Showing 183 changed files with 1,086 additions and 1,334 deletions.
2 changes: 1 addition & 1 deletion .c8rc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"lines": 100,
"functions": 100,
"statements": 100,
"exclude": ["/node_modules/", "/scripts/", "/src/prettier-comments/"],
"exclude": ["/node_modules/", "/src/prettier-comments/"],
"include": ["src/**/*.js", "!src/prettier-comments/**/*.js"],
"reporter": ["lcov", "text"],
"temp-dir": "./coverage/"
Expand Down
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ dist/**/*.js
tests/format/**/*.sol
tests/format/Markdown/Markdown.md
tests/format/RespectDefaultOptions/respect-default-options.js
tests/config/**/*.js
tests/config/**/*.*js
src/prettier-comments/**/*.js
8 changes: 8 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,13 @@
"extends": ["airbnb-base", "prettier"],
"globals": {
"run_spec": false
},
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"rules": {
"import/extensions": "off",
"import/prefer-default-export": "off"
}
}
4 changes: 1 addition & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,8 @@ jobs:
run: npm run build
- name: Downgrade Prettier to V2
run: npm install [email protected]
- name: Run tests
run: npm run test:all
- name: Run standalone tests
run: npm run test:standalone
run: npm run test:standalone tests/format tests/unit/prettier-version

test_linux:
name: Test on Linux with Node ${{ matrix.node }}
Expand Down
1 change: 0 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# -*- mode: gitignore; -*-
.github/
tests/
scripts/
assets/
*.md/
!README.md
4 changes: 2 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const TEST_STANDALONE = Boolean(process.env.TEST_STANDALONE);

module.exports = {
export default {
runner: 'jest-light-runner',
setupFiles: ['<rootDir>/tests/config/setup.js'],
snapshotSerializers: [
Expand All @@ -19,7 +19,7 @@ module.exports = {
: [],
testMatch: [
'<rootDir>/tests/format/**/jsfmt.spec.js',
'<rootDir>/tests/unit/**/*.js'
'<rootDir>/tests/unit/**/*.test.js'
],
transform: {},
watchPlugins: [
Expand Down
Loading

0 comments on commit 326ddfb

Please sign in to comment.