Skip to content

Commit

Permalink
Overhaul project, update to modern standards:
Browse files Browse the repository at this point in the history
- sync with current version of TraceKit
- introduce ESLint + Prettier + EditorConfig
- introduce builds for CJS/ESM/Browser
- port to ES6+
- remove grunt, use npm scripts instead
  • Loading branch information
BendingBender committed Jan 28, 2019
1 parent fb58c13 commit 9fffc11
Show file tree
Hide file tree
Showing 20 changed files with 4,425 additions and 428 deletions.
13 changes: 13 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"browsers": ["last 2 versions", "safari >= 7"]
},
"modules": false
}
]
]
}
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
17 changes: 17 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module.exports = {
env: {
browser: true,
commonjs: true,
es6: true,
node: true,
mocha: true
},
extends: ['eslint:recommended', 'plugin:prettier/recommended'],
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
},
rules: {
'linebreak-style': ['error', 'unix'],
},
};
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/.history
node_modules
dist
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"singleQuote": true,
"trailingComma": "es5"
}
8 changes: 3 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
language: node_js
node_js:
- "iojs"
- "iojs-v2"
- "iojs-v1"
- "0.12"
- "0.10"
- "6"
- "8"
- "10"
sudo: false
18 changes: 18 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Mocha All",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"args": ["--timeout", "999999", "--colors", "--compilers", "js:@babel/register", "'${workspaceFolder}/test/**/*.spec.js'"],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true
}
]
}
20 changes: 0 additions & 20 deletions Gruntfile.js

This file was deleted.

10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,25 @@ This parser parses a stack trace from any browser or Node.js and returns an arra
## Usage

``` JavaScript
import * as stackTraceParser from 'stacktrace-parser';

try {
throw new Error('My error');
} catch(ex) {
var lines = StackTraceParser.parse(ex.stack);
const stack = stackTraceParser.parse(ex.stack);
}
```

Every line contains four properties: `lineNumber`, `methodName`, `file` and `column` (if applicable).
Every line contains four properties: `lineNumber`, `methodName`, `arguments`, `file` and `column` (if applicable).

## TODOs

- allow to run in browser (v0.2)
- parse stack traces from other sources (Ruby, etc) (v0.3)

## Contribution

If you want to contrib, then do you thing, write tests, run `grunt test` ensure that everything is green , commit and make the pull request. Or just write an issue, or let's talk.
If you want to contrib, then do you thing, write tests, run `npm run test` ensure that everything is green,
commit and make the pull request. Or just write an issue, or let's talk.

## Contributors

Expand Down
1 change: 0 additions & 1 deletion index.js

This file was deleted.

53 changes: 0 additions & 53 deletions lib/stacktrace-parser.js

This file was deleted.

4 changes: 4 additions & 0 deletions mocha-babel-hook.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// different babel config for mocha, need to transpile modules
require('@babel/register')({
presets: ['@babel/preset-env'],
});
Loading

0 comments on commit 9fffc11

Please sign in to comment.