Skip to content
Merged
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
3 changes: 3 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [['@babel/preset-env', { targets: { node: 'current' } }]],
};
6 changes: 6 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ export default defineConfig([
extends: ['js/recommended'],
languageOptions: { globals: globals.node },
},
{
files: ['test/**/*.{js,mjs,cjs,ts,mts,cts}'],
plugins: { js },
extends: ['js/recommended'],
languageOptions: { globals: { ...globals.node, ...globals.vitest } },
},
tseslint.configs.recommended,
eslintPluginPrettierRecommended,
{
Expand Down
4 changes: 2 additions & 2 deletions grafana/annotations/graphite.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function Graphite(opts) {
var self = this;

if (!opts.name) {
throw errors.UnfulfilledRequirement(
throw errors.UnfulfilledRequirement.create(
'{component} missing requirement: {unfulfilledArg}',
{
component: 'grafana.annotations.Graphite',
Expand All @@ -37,7 +37,7 @@ function Graphite(opts) {
}

if (!opts.target) {
throw errors.UnfulfilledRequirement(
throw errors.UnfulfilledRequirement.create(
'{component} missing requirement: {unfulfilledArg}',
{
component: 'grafana.annotations.Graphite',
Expand Down
10 changes: 5 additions & 5 deletions grafana/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function publish(dashboard, opts) {
opts = opts || {};

if (!dashboard) {
throw errors.UnfulfilledRequirement(
throw errors.UnfulfilledRequirement.create(
'{component} missing requirement: {unfulfilledArg}',
{
component: 'grafana.publish',
Expand All @@ -40,7 +40,7 @@ function publish(dashboard, opts) {
const cfg = config.getConfig();

if (!state || !state.title) {
throw errors.InvalidState(
throw errors.InvalidState.create(
'{component} state is invalid: state.{invalidArg} {reason}',
{
component: 'grafana.Dashboard',
Expand All @@ -51,7 +51,7 @@ function publish(dashboard, opts) {
}

if (!cfg.url) {
throw errors.Misconfigured(
throw errors.Misconfigured.create(
'Incorrect configuration: config.{invalidArg} {reason} - {resolution}',
{
invalidArg: 'url',
Expand All @@ -62,7 +62,7 @@ function publish(dashboard, opts) {
}

if (!cfg.cookie) {
throw errors.Misconfigured(
throw errors.Misconfigured.create(
'Incorrect configuration: config.{invalidArg} {reason} - {resolution}',
{
invalidArg: 'cookie',
Expand Down Expand Up @@ -91,7 +91,7 @@ function publish(dashboard, opts) {
console.log('Published the dashboard', state.title);
return resp.text();
} else {
throw new errors.ResponseError('request failed: {name}', {
throw errors.ResponseError.create('request failed: {name}', {
name: resp.statusText,
response: resp,
});
Expand Down
4 changes: 4 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/** @type {import("jest").Config} **/
module.exports = {
testEnvironment: 'node',
};
Loading