Skip to content

Commit edd0d1d

Browse files
committed
feat: Create eslint config
1 parent 9428c9a commit edd0d1d

File tree

10 files changed

+5752
-177
lines changed

10 files changed

+5752
-177
lines changed

.eslintignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# THIS IS A TEMPORARY FILE
2+
# THIS WILL BE REMOVED AFTER WE FINISH ESLINT UPGRADE
3+
4+
packages/apm/**/*
5+
packages/core/**/*
6+
packages/ember/**/*
7+
packages/gatsby/**/*
8+
packages/hub/**/*
9+
packages/integrations/**/*
10+
packages/minimal/**/*
11+
packages/node/**/*
12+
packages/react/**/*
13+
packages/tracing/**/*
14+
packages/types/**/*
15+
packages/typescript/**/*
16+
packages/utils/**/*

.eslintrc.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
module.exports = {
2+
root: true,
3+
env: {
4+
node: true,
5+
},
6+
extends: ['prettier', 'eslint:recommended'],
7+
plugins: ['sentry-sdk'],
8+
overrides: [
9+
{
10+
files: ['*.ts'],
11+
extends: ['plugin:@typescript-eslint/recommended', 'prettier/@typescript-eslint'],
12+
plugins: ['@typescript-eslint'],
13+
parser: '@typescript-eslint/parser',
14+
rules: {
15+
'sentry-sdk/no-async-await': 'error',
16+
},
17+
},
18+
{
19+
env: {
20+
jest: true,
21+
},
22+
files: ['*.test.ts'],
23+
extends: ['plugin:@typescript-eslint/recommended', 'prettier/@typescript-eslint'],
24+
plugins: ['@typescript-eslint'],
25+
parser: '@typescript-eslint/parser',
26+
},
27+
{
28+
files: ['*.config.js'],
29+
parserOptions: {
30+
sourceType: 'module',
31+
ecmaVersion: 2018,
32+
},
33+
},
34+
],
35+
rules: {},
36+
};

.vscode/extensions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
// See http://go.microsoft.com/fwlink/?LinkId=827846
33
// for the documentation about the extensions.json format
4-
"recommendations": ["esbenp.prettier-vscode", "ms-vscode.vscode-typescript-tslint-plugin"]
4+
"recommendations": ["esbenp.prettier-vscode", "ms-vscode.vscode-typescript-tslint-plugin", "dbaeumer.vscode-eslint"]
55
}

eslint-plugin-sentry-sdk/index.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// This is a temporary file. It will be removed when we migrate
2+
// the eslint configs to another repo.
3+
4+
'use strict';
5+
6+
/**
7+
* Rule to disallow usage of async await
8+
* @author Abhijeet Prasad
9+
*/
10+
const noAsyncAwait = {
11+
meta: {
12+
type: 'problem',
13+
docs: {
14+
description: 'Disallow usage of async await',
15+
category: 'Best Practices',
16+
recommended: true,
17+
},
18+
fixable: null,
19+
schema: [],
20+
},
21+
create: function(context) {
22+
return {
23+
FunctionDeclaration(node) {
24+
if (node.async) {
25+
context.report({
26+
node,
27+
message:
28+
'Using async-await can add a lot to bundle size. Please do not use it outside of tests, use Promises instead',
29+
});
30+
}
31+
},
32+
};
33+
},
34+
};
35+
36+
module.exports = {
37+
rules: {
38+
'no-async-await': noAsyncAwait,
39+
},
40+
};
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"name": "eslint-plugin-sentry-sdk",
3+
"version": "0.0.1",
4+
"main": "index.js",
5+
"devDependencies": {
6+
"eslint": "^7.5.0"
7+
},
8+
"engines": {
9+
"node": ">=0.10.0"
10+
}
11+
}

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,15 @@
4343
"@types/mocha": "^5.2.0",
4444
"@types/node": "^11.13.7",
4545
"@types/sinon": "^7.0.11",
46+
"@typescript-eslint/eslint-plugin": "^3.7.1",
47+
"@typescript-eslint/parser": "^3.7.1",
4648
"chai": "^4.1.2",
4749
"codecov": "^3.6.5",
4850
"danger": "^7.1.3",
4951
"danger-plugin-tslint": "^2.0.0",
52+
"eslint": "^7.5.0",
53+
"eslint-config-prettier": "^6.11.0",
54+
"eslint-plugin-sentry-sdk": "file:./eslint-plugin-sentry-sdk",
5055
"jest": "^24.7.1",
5156
"karma-browserstack-launcher": "^1.5.1",
5257
"karma-firefox-launcher": "^1.1.0",

packages/browser/.eslintrc.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
module.exports = {
2+
root: true,
3+
env: {
4+
es6: true,
5+
browser: true,
6+
},
7+
extends: ['../../.eslintrc.js'],
8+
ignorePatterns: ['build/**/*', 'dist/**/*', 'esm/**/*', 'examples/**/*', 'scripts/**/*'],
9+
overrides: [
10+
{
11+
files: ['test/integration/**/*'],
12+
env: {
13+
mocha: true,
14+
},
15+
rules: {
16+
'no-undef': 'off',
17+
},
18+
},
19+
{
20+
files: ['test/integration/common/**/*'],
21+
rules: {
22+
'no-unused-vars': 'off',
23+
},
24+
},
25+
],
26+
rules: {},
27+
};

packages/browser/package.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
"rollup-plugin-terser": "^4.0.4",
5050
"rollup-plugin-typescript2": "^0.21.0",
5151
"sinon": "^7.3.2",
52-
"tslint": "5.16.0",
5352
"typescript": "3.4.5",
5453
"webpack": "^4.30.0"
5554
},
@@ -64,13 +63,13 @@
6463
"build:watch": "run-p build:dist:watch build:esm:watch build:bundle:watch",
6564
"clean": "rimraf dist coverage .rpt2_cache build esm",
6665
"link:yarn": "yarn link",
67-
"lint": "run-s lint:prettier lint:tslint",
66+
"lint": "run-s lint:eslint lint:tslint",
6867
"lint:prettier": "prettier-check \"{src,test}/**/*.ts\"",
69-
"lint:tslint": "tslint -t stylish -p .",
70-
"lint:tslint:json": "tslint --format json -p . | tee lint-results.json",
71-
"fix": "run-s fix:tslint fix:prettier",
68+
"lint:eslint": "eslint . --format stylish",
69+
"lint:eslint:json": "eslint . --format json | tee lint-results.json",
70+
"fix": "run-s fix:eslint fix:prettier",
7271
"fix:prettier": "prettier --write \"{src,test}/**/*.ts\"",
73-
"fix:tslint": "tslint --fix -t stylish -p .",
72+
"fix:eslint": "lint:eslint --fix",
7473
"test": "run-s test:unit",
7574
"test:unit": "karma start test/unit/karma.conf.js",
7675
"test:unit:watch": "karma start test/unit/karma.conf.js --auto-watch --no-single-run",

packages/browser/tslint.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)