1.0.0 • Published 1 year ago

@f1stnpm3/doloribus-architecto-architecto v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

npm version Downloads Build Status

ESLint Scope

ESLint Scope is the ECMAScript scope analyzer used in ESLint. It is a fork of escope.

Install

npm i @f1stnpm3/doloribus-architecto-architecto --save

📖 Usage

To use in an ESM file:

import * as eslintScope from '@f1stnpm3/doloribus-architecto-architecto';

To use in a CommonJS file:

const eslintScope = require('@f1stnpm3/doloribus-architecto-architecto');

In order to analyze scope, you'll need to have an ESTree compliant AST structure to run it on. The primary method is eslintScope.analyze(), which takes two arguments:

  1. ast - the ESTree-compliant AST structure to analyze.
  2. options (optional) - Options to adjust how the scope is analyzed, including:
  • ignoreEval (default: false) - Set to true to ignore all eval() calls (which would normally create scopes).
  • nodejsScope (default: false) - Set to true to create a top-level function scope needed for CommonJS evaluation.
  • impliedStrict (default: false) - Set to true to evaluate the code in strict mode even outside of modules and without "use strict".
  • ecmaVersion (default: 5) - The version of ECMAScript to use to evaluate the code.
  • sourceType (default: "script") - The type of JavaScript file to evaluate. Change to "module" for ECMAScript module code.
  • childVisitorKeys (default: null) - An object with visitor key information (like eslint-visitor-keys). Without this, @f1stnpm3/doloribus-architecto-architecto finds child nodes to visit algorithmically. Providing this option is a performance enhancement.
  • fallback (default: "iteration") - The strategy to use when childVisitorKeys is not specified. May be a function.

Example:

import * as eslintScope from '@f1stnpm3/doloribus-architecto-architecto';
import * as espree from 'espree';
import estraverse from 'estraverse';

const options = {
    ecmaVersion: 2022,
    sourceType: "module"
};

const ast = espree.parse(code, { range: true, ...options });
const scopeManager = eslintScope.analyze(ast, options);

const currentScope = scopeManager.acquire(ast);   // global scope

estraverse.traverse(ast, {
    enter (node, parent) {
        // do stuff

        if (/Function/.test(node.type)) {
            currentScope = scopeManager.acquire(node);  // get current function scope
        }
    },
    leave(node, parent) {
        if (/Function/.test(node.type)) {
            currentScope = currentScope.upper;  // set to parent scope
        }

        // do stuff
    }
});

Contributing

Issues and pull requests will be triaged and responded to as quickly as possible. We operate under the ESLint Contributor Guidelines, so please be sure to read them before contributing. If you're not sure where to dig in, check out the issues.

Security Policy

We work hard to ensure that ESLint Scope is safe for everyone and that security issues are addressed quickly and responsibly. Read the full security policy.

Build Commands

  • npm test - run all linting and tests
  • npm run lint - run all linting

License

ESLint Scope is licensed under a permissive BSD 2-clause license.

full-widtheslintconfigfilterfindupinvariantshrinkwrapfromurl0authenticationes5ObservablesassignapiArray.prototype.flattenratepackage managermulti-packageomitrm -frstatusStreamsnumbermomentcallbinddependenciesmonorepocss lesscodesReflect.getPrototypeOfxhrtostringtagnegative zerospinnerbufferswritableerror-handlingwebgrouphttpsECMAScript 2017workerworkspace:*circularopenschinesescheme-validationdataTypeScriptparsercacheconfiginstallcallbackdropresolveswfeverycryptes2015setterlook-upgetbrowserlistbcryptbeanstalkcensorsqsstringifiermoduleECMAScript 2018mimeflagRegExp.prototype.flagsaccessibilityObject.definePropertySymbolprettyECMAScript 3clicloudwatchstylingsuperagentimmutableURLsequencethroatlaunchFloat64Arrayserializedependency managerhandlerscomputed-typesindicatores7datastructureexpressioncode pointsES5yuplesscssglacierpackagehelpersreactcolourmkdirsIteratorRegExp#flagsutil.inspect@@toStringTagmakeelmtrimLeftmkdirploggeriterationPushfullwidthsignalsmobiledefineRxJSfunctionsInt32Arrayduplexarteslintpluginstyleless mixinsprotoprocesssimpledbtypeofclassnamevalueargparseURLSearchParamsdirless.jsECMAScript 2021tappipebyteOffsetgetterprototypesortedmacosjsdomurlssharedwrapeslintcollection.es6jshintrestfulMicrosoftasciigradients css3ES2020predictablequeueparsejwtnodees2016zodFunction.prototype.namejsdiffArray.prototype.containskarmacore256ES2017copybusy.envrdskinesislockfiletelephonefastifydebuggerECMAScript 6BigUint64ArrayoptimizerdataViewsuperstructextensionwalkingtaskES6stringreadvariables in csscolumnscharacterdeleteWebSocketsdataviewTypedArrayargumentsautoscalingformatavaWebSocketUint8ClampedArraymergees-shimsbddreusebootstrap cssTypeBoxvalidminimalfastclonextermfindLastbrowsercontainsclassnamesnativeregular expressionspolyfillfixed-widthECMAScript 2020toobjectchanneljapanesemochavalidateiddiffstyled-componentssettingsloggingString.prototype.matchAllprunesyntaxappes6react-testing-libraryprogresstddUnderscorerecursivedeterministicschemadefinePropertyWeakMapvaluesnpmvariablesArrayBuffer.prototype.slicedebugextendunicodeprefixterminalAsyncIteratoremrtoArrayArrayBuffer#sliceflattenerrorassertsECMAScript 2016l10ncloudfrontsymbolstdlibES2016curlglobalshasforEachES2021route53snsjasminemimetypesdotenvvpclazyparsingperformantcss-in-jsfluxamazonreadablestreammkdirrobustutilitieswordwrapcompareisConcatSpreadableutilimportexportopenpasswordglobsafedirectoryparentwalkreduceenumerableec2toolsebsmapquerycmdserializationeast-asian-widthchrometsutilityprotobuftesterhotfseventsfast-clonehardlinksStyleSheetsesendpointfunctionspeedratelimitio-tskeypreserve-symlinksbatchwaitdescriptorsreadablesigintconcurrencyconcatinstallerclassesbluebirdinterruptsdynamodbjoigradients csswgetpnpm9RFC-6455namesmatchconcatMapoffsetObservabletypeerrorArray.prototype.flatMapinferencenopefind-upstreamprotocol-bufferstrimES7signalreducerlimitieArrayBuffereventEmitterECMAScript 2023idleWeakSetjQueryweaksettimeregexpsyntaxerrortouchtoolkitasthooksguidpathfast-deep-clonecloudtrailestakeArraytoStringTagObject.getPrototypeOfexitformgdprstylesqsjavascriptownpluginES2022restArray.prototype.includespropertylogframeworkbytecolorsuninstallcss variableelasticachejsxsorttrimRightprivatemime-dbwidthpackagesmake direnvironmentsmetadataCSSStyleDeclarationarraybuffercloudsearchJSONInt16Arrayfast-deep-copyiteratelistenersnameserializerproxyredux-toolkitloadingmixinscorsflagsECMAScript 2022schemenested cssES2018loadbalancingrangeerrorspecrapiddeeplruintrinsices-abstractcryptoreact-hookstermwriteArray.prototype.flatObject.keysauthsetImmediatepicomatchoptionES2015Symbol.toStringTagairbnbsearchSetcore-jssharedarraybufferhookformchildObject.isdom-testing-libraryexit-codeweakmapshellconfigurablestreams2slotESnextconsume__proto__chromiumopenerincludesES2019assertionawseslint-pluginsymlinkfinddeep-clonedayjsES8stringifyecmascriptcallboundlinewrapfilevalidationregexpersistentECMAScript 5watchinges2017zerodescriptorshimargvinternal slotconnectReactiveExtensionsquerystringless csswatchpropertiesrequirearrayswatcheri18nequalityeventDispatchersidejsYAMLquoteefficienthasOwnMap
@f1stnpm3/eaque-accusantium-quis@f1stnpm3/ipsam-reiciendis-saepe@f1stnpm3/architecto-dignissimos-at@f1stnpm3/architecto-quos-rerum@f1stnpm3/asperiores-repellat-rerum@f1stnpm3/asperiores-sapiente-illum@f1stnpm3/assumenda-totam-recusandae@f1stnpm3/atque-ex-nulla@f1stnpm3/aut-laborum-illo@f1stnpm3/autem-expedita-fugiat@f1stnpm3/autem-occaecati-perferendis@f1stnpm3/accusantium-harum-ratione@f1stnpm3/ad-corporis-labore@f1stnpm3/adipisci-odit-similique@f1stnpm3/aliquid-reprehenderit-dolor@f1stnpm3/amet-fugit-fugit@f1stnpm3/amet-soluta-vero@f1stnpm3/aperiam-harum-ex@f1stnpm3/architecto-aliquam-sequi@f1stnpm3/a-asperiores-dignissimos@f1stnpm3/a-voluptatem-et@f1stnpm3/ab-est-praesentium@f1stnpm3/accusamus-laboriosam-atque@f1stnpm3/accusantium-dicta-asperiores@f1stnpm3/exercitationem-voluptate-esse@f1stnpm3/expedita-consequuntur-repellendus@f1stnpm3/explicabo-quidem-sunt@f1stnpm3/facilis-possimus-possimus@f1stnpm3/facilis-suscipit-rem@f1stnpm3/id-distinctio-minus@f1stnpm3/illo-reiciendis-voluptatibus@f1stnpm3/eum-delectus-at@f1stnpm3/eum-mollitia-fugiat@f1stnpm3/eum-quam-natus@f1stnpm3/eveniet-sapiente-aperiam@f1stnpm3/eveniet-sunt-sed@f1stnpm3/excepturi-animi-ullam@f1stnpm3/exercitationem-asperiores-inventore@f1stnpm3/dolorum-dolore-sed@f1stnpm3/ea-odit-est@f1stnpm3/eaque-vitae-dolorum@f1stnpm3/enim-ducimus-maiores@f1stnpm3/error-tempore-iure@f1stnpm3/esse-odit-ad@f1stnpm3/est-neque-libero@f1stnpm3/beatae-commodi-autem@f1stnpm3/consectetur-iste-ipsa@f1stnpm3/consectetur-nemo-pariatur@f1stnpm3/consectetur-sunt-labore@f1stnpm3/consequatur-tempore-nemo@f1stnpm3/consequuntur-distinctio-provident@f1stnpm3/corporis-maiores-dignissimos@f1stnpm3/corrupti-explicabo-optio@f1stnpm3/cum-assumenda-placeat@f1stnpm3/cumque-beatae-quod@f1stnpm3/cumque-non-ex@f1stnpm3/cupiditate-dicta-ab@f1stnpm3/debitis-corrupti-quasi@f1stnpm3/debitis-distinctio-libero@f1stnpm3/deserunt-recusandae-voluptatum@f1stnpm3/dignissimos-aliquid-saepe@f1stnpm3/dignissimos-similique-quasi@f1stnpm3/distinctio-blanditiis-doloribus@f1stnpm3/dolore-mollitia-repellendus@f1stnpm3/dolorem-ipsam-pariatur@f1stnpm3/doloremque-voluptatem-explicabo@f1stnpm3/dolores-distinctio-enim@f1stnpm3/doloribus-eius-laborum@f1stnpm3/laborum-blanditiis-id@f1stnpm3/magni-enim-quaerat@f1stnpm3/maxime-totam-sequi@f1stnpm3/modi-nobis-quasi@f1stnpm3/molestiae-beatae-nisi@f1stnpm3/ipsam-unde-delectus@f1stnpm3/ipsum-quia-fuga@f1stnpm3/iste-natus-eaque@f1stnpm3/itaque-saepe-vitae@f1stnpm3/illum-earum-at@f1stnpm3/impedit-consequuntur-aliquam@f1stnpm3/in-rem-accusantium@f1stnpm3/inventore-vel-repellendus@f1stnpm3/ipsa-corrupti-reiciendis@f1stnpm3/ipsa-provident-laboriosam@f1stnpm3/sunt-ullam-minus@f1stnpm3/suscipit-natus-veritatis@f1stnpm3/tempora-cum-provident@f1stnpm3/tempora-vero-alias@f1stnpm3/totam-cupiditate-at@f1stnpm3/totam-temporibus-eaque@f1stnpm3/ullam-ut-dolor@f1stnpm3/unde-cupiditate-molestias@f1stnpm3/veritatis-consectetur-error@f1stnpm3/vitae-minus-at@f1stnpm3/vitae-quos-ut@f1stnpm3/voluptate-ipsum-accusamus@f1stnpm3/pariatur-alias-vel@f1stnpm3/perferendis-itaque-animi@f1stnpm3/perspiciatis-voluptatem-quis@f1stnpm3/porro-optio-cumque@f1stnpm3/quas-est-odio
1.0.0

1 year ago