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

Migration to typescript Step 1 #968

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
9 changes: 5 additions & 4 deletions .c8rc
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"check-coverage": true,
"branches": 99,
"lines": 100,
"branches": 97,
"lines": 99,
"functions": 100,
"statements": 100,
"statements": 99,
"exclude": ["/node_modules/", "/src/prettier-comments/"],
"include": [
"src/**/*.js",
"!src/prettier-comments/**/*.js",
"src/**/*.ts",
"!src/prettier-comments/**/*.ts",
"!src/common/backward-compatibility.js"
],
"reporter": ["lcov", "text"],
Expand Down
5 changes: 3 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
coverage/**/*.js
dist/**/*.js
dist/**/*.cjs
tests/**/*.snap
tests/format/**/*.sol
tests/format/Markdown/Markdown.md
tests/format/RespectDefaultOptions/respect-default-options.js
tests/config/**/*.*js
src/prettier-comments/**/*.js
src/prettier-comments/**/*.ts
37 changes: 27 additions & 10 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,33 @@
"env": {
"jest": true
},
"extends": ["airbnb-base", "prettier"],
"globals": {
"run_spec": false
"run_spec": "readonly"
},
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"rules": {
"import/extensions": "off",
"import/prefer-default-export": "off"
}
"overrides": [
{
"files": ["**/*.ts"],
"extends": ["prettier", "plugin:@typescript-eslint/recommended"],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"parserOptions": {
"project": ["tsconfig.json"]
},
"rules": {
"@typescript-eslint/explicit-function-return-type": "error"
}
},
{
"files": ["**/*.*js"],
"extends": ["airbnb-base", "prettier"],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"rules": {
"import/extensions": "off",
"import/prefer-default-export": "off"
}
}
]
}
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
- name: Build test app
run: npm run build:test
- name: Run standalone tests
run: npm run test:standalone tests/format tests/integration tests/unit/prettier-version
run: npm run test:standalone

test_linux:
name: Test on Linux with Node ${{ matrix.node }}
Expand Down
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ dist/**/*.js
tests/format/**/*.sol
tests/format/Markdown/Markdown.md
tests/format/RespectDefaultOptions/respect-default-options.js
src/prettier-comments/**/*.js
src/prettier-comments/**/*.ts
17 changes: 8 additions & 9 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
const TEST_STANDALONE = Boolean(process.env.TEST_STANDALONE);
const testMatch = [
'<rootDir>/tests/format/**/jsfmt.spec.js',

'<rootDir>/tests/unit/**/*.test.js'
];
const testMatch = ['<rootDir>/tests/format/**/jsfmt.spec.js'];

if (TEST_STANDALONE) {
testMatch.push('<rootDir>/tests/integration/**/*.test.js');
testMatch.push(
'<rootDir>/tests/integration/**/*.test.js',
'<rootDir>/tests/unit/prettier-version/**/*.test.js'
);
} else {
testMatch.push('<rootDir>/tests/unit/**/*.test.js');
}

export default {
runner: 'jest-light-runner',
setupFiles: ['<rootDir>/tests/config/setup.js'],
setupFiles: ['<rootDir>/tests/config/format-test-setup.js'],
snapshotSerializers: [
'jest-snapshot-serializer-raw',
'jest-snapshot-serializer-ansi'
],
testEnvironment: 'node',
// ignore console warnings in TEST_STANDALONE
silent: TEST_STANDALONE,
testPathIgnorePatterns: TEST_STANDALONE
Expand All @@ -27,7 +27,6 @@ export default {
]
: [],
testMatch,
transform: {},
watchPlugins: [
'jest-watch-typeahead/filename',
'jest-watch-typeahead/testname'
Expand Down
Loading
Loading