GithubHelp home page GithubHelp logo

Comments (7)

qfox avatar qfox commented on June 2, 2024

@Rantanen It's more like a feature request to node-jscs.
Did you mean both globally installed node-jscs and jscs-jsdoc didn't work together? Right?
Please provide additionalRules config block.

from jscs-jsdoc.

Rantanen avatar Rantanen commented on June 2, 2024

Yeah, saw jscs-dev/node-jscs#312 at node-jscs where they requested this as an external package.

Running globally installed node-jscs and globally installed jscs-jsdoc. Config block was copied from the README.md:

{
    "additionalRules": [
        "node_modules/jscs-jsdoc/lib/rules/*.js"
    ],
    "jsDoc": {
    }
}

The issue is in the jscs checker.js. additionalRules are resolved with...

(config.additionalRules || []).forEach(function(pattern) {
    glob.sync(path.resolve(cwd, pattern)).map(function(path) {
        var Rule = require(path);
        this.registerRule(new Rule());
    }, this);
}, this);
  • pattern here is the configured string from the config: node_modules/jscs-jsdoc/lib/rules/*.js
  • cwd is either configuration directory (The directory in which .jscsrc resides) or the current process directory if no configuration file exists.
  • path.resolve just concatenates these together resulting in absolute path.

At least I can't figure out how it would be possible to configure this globally without changing the jscs logic in resolving additionalRules.

(And mentioning jscs-dev/node-jscs#321 here to link this to upstream)

from jscs-jsdoc.

qfox avatar qfox commented on June 2, 2024

Thanks for widely described configuration and bug report.
I'll fix it in several hours. If it is possible ofc ;-)

from jscs-jsdoc.

qfox avatar qfox commented on June 2, 2024

@Rantanen Yeah. All is right, but didn't work because glob can't search in all directories in NODE_PATH.
We can prepend and look up for a file in each place and resolve the closest module path and load rules from it. E.g. replace /^node_modules\// to each of them and try to resolve. But I think it is too complicated.

> require.resolve('jscs-jsdoc')
'/usr/local/lib/node_modules/jscs-jsdoc/lib/index.js'
> process.env.NODE_PATH
':/usr/local/lib/node_modules'
> module.constructor.globalPaths
[ '',
  '/usr/local/lib/node_modules',
  '/home/alex/.node_modules',
  '/home/alex/.node_libraries',
  '/opt/node-v0.10.26-linux-x86/lib/node' ]

We will have a problem with different versions of the same module placed in several places. We should filter them manually. Etc.
I think we should left this functionality to load custom project rules. But also we need another functionality to load plugin-extension packages via npm. With require or require.resolve.

Anyway, we can't do it on the plugin level. ;-(

from jscs-jsdoc.

qfox avatar qfox commented on June 2, 2024

Oh, sorry. You can temporary use the simple solution npm ln jscs-jsdoc.
It will find your globally installed module and symlink it to your local env: ./node_modules/jscs-jsdoc

from jscs-jsdoc.

Rantanen avatar Rantanen commented on June 2, 2024

Yeah, symlink works - but at that point I could just do a full local installation as well. My need for a global installation was a plan to introduce jscs in a .NET company.

Thanks to jshint, browserify, jscs, etc. node is becoming an important tool platform for all JavaScript development development. But this depends greatly on the ability to install these tools globally.

Unfortunately node-jscs still has a bit to go until it is mature enough to set up conveniently in global fashion.

So for my personal use I'm happy to use a local installation and I'm going to wait until node-jscs solves these issues until including it in the toolchain at the said company.

from jscs-jsdoc.

qfox avatar qfox commented on June 2, 2024

@Rantanen Got it. I hope that maintainers will respond asap to make true plugins works. I'll do my best to release this. Don't like unfinished projects ;-)

from jscs-jsdoc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.