How to use deprecation - 10 common examples

To help you get started, we’ve selected a few deprecation examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github YOCKOW / Action-setup-swift / node_modules / @octokit / rest / plugins / authentication / index.js View on Github external
return;
  }

  // Otherwise log a deprecation message
  const [deprecationMethod, deprecationMessapge] = isBasicAuthString
    ? [
        deprecateAuthBasic,
        'Setting the "new Octokit({ auth })" option to a Basic Auth string is deprecated. Use https://github.com/octokit/auth-basic.js instead. See (https://octokit.github.io/rest.js/#authentication)'
      ]
    : [
        deprecateAuthObject,
        'Setting the "new Octokit({ auth })" option to an object without also setting the "authStrategy" option is deprecated and will be removed in v17. See (https://octokit.github.io/rest.js/#authentication)'
      ];
  deprecationMethod(
    octokit.log,
    new Deprecation("[@octokit/rest] " + deprecationMessapge)
  );

  octokit.auth = () =>
    Promise.resolve({
      type: "deprecated",
      message: deprecationMessapge
    });

  validate(options.auth);

  const state = {
    octokit,
    auth: options.auth
  };

  octokit.hook.before("request", beforeRequest.bind(null, state));
github octokit / rest.js / lib / parse-client-options.js View on Github external
if (options.userAgent) {
    clientDefaults.headers["user-agent"] = options.userAgent;
  }

  if (options.previews) {
    clientDefaults.mediaType.previews = options.previews;
  }

  if (options.timeZone) {
    clientDefaults.headers["time-zone"] = options.timeZone;
  }

  if (options.timeout) {
    deprecateOptionsTimeout(
      log,
      new Deprecation(
        "[@octokit/rest] new Octokit({timeout}) is deprecated. Use {request: {timeout}} instead. See https://github.com/octokit/request.js#request"
      )
    );
    clientDefaults.request.timeout = options.timeout;
  }

  if (options.agent) {
    deprecateOptionsAgent(
      log,
      new Deprecation(
        "[@octokit/rest] new Octokit({agent}) is deprecated. Use {request: {agent}} instead. See https://github.com/octokit/request.js#request"
      )
    );
    clientDefaults.request.agent = options.agent;
  }
github Azure / dev-spaces / actions / add-review-url / node_modules / @octokit / request-error / dist-web / index.js View on Github external
get() {
        logOnce(new Deprecation("[@octokit/request-error] `error.code` is deprecated, use `error.status`."));
        return statusCode;
      }
github newrelic / newrelic-ruby-agent / .github / actions / build-ruby / node_modules / @octokit / request-error / dist-node / index.js View on Github external
get() {
        logOnce(new deprecation.Deprecation("[@octokit/request-error] `error.code` is deprecated, use `error.status`."));
        return statusCode;
      }
github YOCKOW / Action-setup-swift / node_modules / @octokit / plugin-rest-endpoint-methods / dist-src / register-endpoints.js View on Github external
Object.keys(options).forEach(key => {
            if (apiOptions.params[key] && apiOptions.params[key].deprecated) {
                const aliasKey = apiOptions.params[key].alias;
                octokit.log.warn(new Deprecation(`[@octokit/rest] "${key}" parameter is deprecated for "${methodName}". Use "${aliasKey}" instead`));
                if (!(aliasKey in options)) {
                    options[aliasKey] = options[key];
                }
                delete options[key];
            }
        });
        return method(options);
github newrelic / newrelic-ruby-agent / .github / actions / build-ruby / node_modules / @octokit / request-error / dist-src / index.js View on Github external
get() {
                logOnce(new Deprecation("[@octokit/request-error] `error.code` is deprecated, use `error.status`."));
                return statusCode;
            },
        });
github Azure / dev-spaces / actions / add-review-url / node_modules / @octokit / request-error / dist-src / index.js View on Github external
get() {
                logOnce(new Deprecation("[@octokit/request-error] `error.code` is deprecated, use `error.status`."));
                return statusCode;
            }
        });
github octokit / rest.js / plugins / pagination / normalize-paginated-list-response.js View on Github external
get() {
        deprecateIncompleteResults(
          octokit.log,
          new Deprecation(
            '[@octokit/rest] "result.data.incomplete_results" is deprecated.'
          )
        );
        return incompleteResults;
      }
    });
github octokit / rest.js / plugins / register-endpoints / register-endpoints.js View on Github external
Object.keys(options).forEach(key => {
      if (apiOptions.params[key] && apiOptions.params[key].deprecated) {
        const aliasKey = apiOptions.params[key].alias;

        octokit.log.warn(
          new Deprecation(
            `[@octokit/rest] "${key}" parameter is deprecated for "${methodName}". Use "${aliasKey}" instead`
          )
        );

        if (!(aliasKey in options)) {
          options[aliasKey] = options[key];
        }
        delete options[key];
      }
    });
github octokit / rest.js / plugins / pagination / normalize-paginated-list-response.js View on Github external
get() {
        deprecateTotalCount(
          octokit.log,
          new Deprecation(
            '[@octokit/rest] "result.data.repository_selection" is deprecated.'
          )
        );
        return repositorySelection;
      }
    });

deprecation

Log a deprecation message with stack

ISC
Latest version published 5 years ago

Package Health Score

69 / 100
Full package analysis

Popular deprecation functions