Giter VIP home page Giter VIP logo

eslint-plugin-suitescript's Introduction

Hello! ๐Ÿ‘‹

I'm a full stack software engineer with a front end focus (design, UX, accessibility, etc). Everything I make is pixel-perfect.

Most of my projects are centered around livestreaming tools.

I also work on real-time audio/visual projects in TouchDesigner (see this and this), After Effects, and Cinema 4D.

eslint-plugin-suitescript's People

Contributors

acdvs avatar michoelchaikin avatar tomo-local avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

eslint-plugin-suitescript's Issues

plugin:suitescript/recommended error

Describe the bug
When I try to use the recommended settings (i.e. "extends": ["plugin:suitescript/recommended"]) I am getting the error:

AssertionError [ERR_ASSERTION]: Node must be provided when reporting error if location is not provided

To Reproduce
Put "extends": ["plugin:suitescript/recommended"] into .eslintrc.json file.

Expected behavior
No error

Node version
14.16.0

ESLint version
8.7.0

Screenshots
image

Additional context
Add any other context about the problem here.

Confused with suitescript/no-log-module

Hi,

I confused with suitescript/no-log-module rule, on why we prefer to use global log object instead of netsuite N/log module, since I didn't found any mention regarding this in suitescript documentation.

Thanks,
Dels

Error Occurs When Importing N/compress and N/dataset Modules

Is your feature request related to a problem? Please describe.
When importing the N/compress module, an error occurs. Additionally, N/dataset is also not supported. I will provide detailed explanations about this issue.

Describe the solution you'd like
I would like the N/compress and N/dataset modules to be integrated correctly into eslint-plugin-suitescript and fixed to prevent errors from occurring.

Describe alternatives you've considered
As an alternative solution to resolve the issue, I have considered whether any specific procedures or configurations are required to work around the problem in the current code, but I couldn't find a solution.

Support for declaring callback outside of define call

Is your feature request related to a problem? Please describe.
Rules using the getModules util function don't work properly unless the second define argument is a FunctionExpression or ArrowFunctionExpression. For example in the following code:

define(['N/record', './lib.js'], main);

function main(record, lib) {}

the no-module-extensions rule would not catch the ".js" file extension.

Describe the solution you'd like
The ability for getModules - and by extension all rules using this function - to support an Identifier as the second define argument and to find the definition of this callback to perform the validation currently done on the callback.

Describe alternatives you've considered
I've already created a fork that does this but it feels somewhat hacky and I can't currently afford to invest the time to learn enough about ESLint to do it "right" (I will still open a PR though, maybe it's a good start)

My initial thought was to try something with no-restricted-syntax specifically to replace the no-module-extensions rule and while I'm sure that's possible it doesn't fix the other rules affected.

Additional context
It would probably be a good idea to do this for the module list too, in case anyone writes their suitescript like

const modules = ['N/record', './lib'];

define(modules, main);

function main(record, lib) {}

Example ESLint Config for SuiteScripts

Is your feature request related to a problem? Please describe.
No problems, this repo is great and I have nothing but positive feelings.

Describe the solution you'd like
An example .eslintrc.js with some standard SuiteScript configuration if possible. Something basic just for SuiteScript that includes rules from this repo. Even if it's just a comment on this issue, it's hard to track down a good starting point.

As an example, here's one I just put together that's a hacked-up version of our standard React/Babel linting:

// .eslintrc.js
module.exports = {
  'env': {
    'browser': true,
    'commonjs': true,
    'es6': true
  },
  'extends': [
    'eslint:recommended',
  ],
  'globals': {
    'define': true,
  },
  'parserOptions': {
    'ecmaVersion': 6,
    'sourceType': 'module',
  },
  'plugins': ['suitescript'],
  'root': true,
  'rules': {
    // Core
    'indent': ['error', 2, {'SwitchCase': 1}],
    'linebreak-style': ['error', 'unix'],
    'quotes': ['error', 'single'],
    'semi': ['error', 'always'],
    // NetSuite/SuiteScript
    'suitescript/api-version': 'error',
    'suitescript/entry-points': 'error',
    'suitescript/log-args': 'error',
    'suitescript/module-vars': 'error',
    'suitescript/no-amd-name': 'error',
    'suitescript/no-extra-modules': 'error',
    'suitescript/no-invalid-modules': 'error',
    'suitescript/no-log-module': 'error',
    'suitescript/no-module-extensions': 'error',
    'suitescript/script-type': 'error',
  }
};

This side-steps errors for "define", adds the SuiteScript rules and has a few other bits. Something like this, but maybe with some refinements from the folks in this project.

Describe alternatives you've considered
I can't find much searching for anything NetSuite that isn't somehow tied to Eclipse or links back to NS docs. Did some cursory ESLint/SuiteScript searches and couldn't find much.

Additional context
Again, thank you. Thanks for even reading this, thanks for this repo.

Add several additional rules

Hi,

Is it possible to add some additional linter rules, such as no-arrow-function and no-let, currently I use:

  • eslint-plugin-es for no-arrow-functions
  • eslint-plugin-fp for no-let

And if perhaps additional language limitation that suitescript (2.0) have, FYR my eslint config

{
    "env": {
        "browser": true,
        "es2020": true
    },
    "extends": "eslint:recommended",
    "plugins": ["es", "fp", "suitescript"],
    "parserOptions": {
        "ecmaVersion": 11
    },
    "ignorePatterns": ["**/lib/*.js"],
    "rules": {
        "eol-last": ["error", "always"],
        "es/no-arrow-functions": "error",
        "fp/no-let": "error",
        "indent": ["error", 4],
        "no-extra-boolean-cast": "off",
        "no-redeclare": "warn",
        "no-undef": "off",
        "no-unused-vars": "warn",
        "object-shorthand": ["error", "never"],
        "quotes": ["error", "single"],
        "suitescript/module-vars": "error",
        "suitescript/no-extra-modules": "error",
        "suitescript/no-invalid-modules": "error",
        "suitescript/no-log-module": "warn",
        "suitescript/script-type": "error"
    }
}

Thanks,
Dels

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.