lib/plugins/plugin/uninstall/uninstall.js/PluginUninstall/removePluginFromServerlessFile
class PluginUninstall:  removePluginFromServerlessFile() {
    return this.getServerlessFilePath().then(serverlessFilePath => {
      if (_.last(_.split(serverlessFilePath, '.')) === 'js') {
        this.serverless.cli.log(`
          Can't automatically remove plugin from "serverless.js" file.
          Please make it manually.
        `);
        return BbPromise.resolve();
      }

      if (_.last(_.split(serverlessFilePath, '.')) === 'json') {
        return fse.readJsonAsync(serverlessFilePath).then(serverlessFileObj => {
          const isArrayPluginsObject = _.isArray(serverlessFileObj.plugins);
          const plugins = isArrayPluginsObject ?
            serverlessFileObj.plugins :
            serverlessFileObj.plugins && serverlessFileObj.plugins.modules;

          if (plugins) {
            _.pull(plugins, this.options.pluginName);
            if (_.isEmpty(plugins)) {
              if (isArrayPluginsObject) {
                _.unset(serverlessFileObj, 'plugins');
              } else {
                _.unset(serverlessFileObj.plugins, 'modules');
              }
            }
            return fse.writeJsonAsync(serverlessFilePath, serverlessFileObj);
          }
          return BbPromise.resolve();
        });
      }

      return this.serverless.yamlParser
      .parse(serverlessFilePath)
      .then((serverlessFileObj) =>
        yamlAstParser.removeExistingArrayItem(
          serverlessFilePath, _.isArray(serverlessFileObj.plugins) ?
            'plugins' : 'plugins.modules', this.options.pluginName));
    });
  }