{"id":13748950,"url":"https://github.com/appcelerator/eslint-config-axway","last_synced_at":"2025-05-09T03:37:34.704Z","repository":{"id":23275564,"uuid":"98571301","full_name":"appcelerator/eslint-config-axway","owner":"appcelerator","description":"Shareable eslint config for Axway projects","archived":false,"fork":false,"pushed_at":"2025-02-10T00:27:45.000Z","size":328,"stargazers_count":16,"open_issues_count":6,"forks_count":8,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-04-14T15:18:49.656Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/appcelerator.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-07-27T19:06:31.000Z","updated_at":"2024-12-17T04:00:49.000Z","dependencies_parsed_at":"2023-02-16T02:00:53.832Z","dependency_job_id":"b8a5f7e3-6ec0-47c3-853a-a57127b87961","html_url":"https://github.com/appcelerator/eslint-config-axway","commit_stats":{"total_commits":137,"total_committers":11,"mean_commits":"12.454545454545455","dds":0.7226277372262774,"last_synced_commit":"2be9b2edbd9600091df69c832528dbff18d0b135"},"previous_names":[],"tags_count":40,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appcelerator%2Feslint-config-axway","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appcelerator%2Feslint-config-axway/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appcelerator%2Feslint-config-axway/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appcelerator%2Feslint-config-axway/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/appcelerator","download_url":"https://codeload.github.com/appcelerator/eslint-config-axway/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253185204,"owners_count":21867800,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T07:00:53.101Z","updated_at":"2025-05-09T03:37:34.684Z","avatar_url":"https://github.com/appcelerator.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# eslint-config-axway\n\nAxway JavaScript coding standards shareable config for [eslint](http://eslint.org/).\n\n* [Installation](#installation)\n* [Usage Overview](#usage-overview)\n* [Usage with npm Scripts](#usage-with-npm-scripts)\n  * [Default Configurations](#default-configuration)\n  * [Custom `.eslintrc` Configurations](#custom-eslintrc-configurations)\n* [Usage with gulp](#usage-with-gulp)\n  * [Default Configuration with Gulp](#default-configuration-with-gulp)\n  * [Custom `.eslintrc` Configurations with Gulp](#custom-eslintrc-configurations-with-gulp)\n  * [Custom eslint Configurations for Source and Tests](#custom-eslint-configurations-for-source-and-tests)\n* [Usage with Titanium](#usage-with-titanium)\n  * [Classic Titanium Apps](#classic-titanium-apps)\n  * [Alloy Apps](#alloy-apps)\n  * [Custom `.eslintrc` for Titanium Apps](#custom-eslintrc-for-titanium-apps)\n  * [Running `eslint` for Titanium Apps](#running-eslint-for-titanium-apps)\n\n## Installation\n\n```\n$ npm i --save-dev eslint eslint-config-axway\n```\n\n## Usage Overview\n\nThere are several ways to incorporate this eslint configuration into your project.\n\n### Step 1\n\nDetermine which environment you wish to target. Choose __ONE__:\n\n| Target Environment   | Description                                   |\n| :------------------- | :-------------------------------------------- |\n| `axway`              | General JavaScript (ES6, ES2016, and ES2017)  |\n| `axway/env-browser`  | Web browser support (extends `axway`)         |\n| `axway/env-node`     | Node.js support (extends `axway`)             |\n| `axway/env-titanium` | Titanium and Alloy support (extends `axway`)  |\n\n\u003e NOTE: The default `axway` configuration automatically includes the\n\u003e [`eslint-plugin-import`](https://www.npmjs.com/package/eslint-plugin-import) and\n\u003e [`eslint-plugin-security`](https://www.npmjs.com/package/eslint-plugin-security) plugins. These\n\u003e help improve the quality of your JavaScript code.\n\n### Step 2 (optional)\n\nSelect additional configurations. These require you to add dependencies to your project:\n`npm i --save-dev \u003cadditional deps\u003e`.\n\n| Addon               | Description               | Additional Dependencies                                        |\n| :------------------ | :------------------------ | :------------------------------------------------------------- |\n| `axway/+babel`      | Support for future specs  | `babel-eslint`                                                 |\n| `axway/+mocha`      | Mocha unit test rules     | `eslint-plugin-mocha`                                          |\n| `axway/+react`      | React.js and .jsx support | `eslint-plugin-react` `eslint-plugin-jsx-a11y`                 |\n| `axway/+chai`       | Chai support              | `eslint-plugin-chai-friendly`                                  |\n| `axway/+typescript` | TypeScript support        | `@typescript-eslint/parser` `@typescript-eslint/eslint-plugin` |\n\n\u003e NOTE: You must use a `.eslintrc` file to specify multiple configurations. Set the\n\u003e [extends](http://eslint.org/docs/user-guide/configuring#extending-configuration-files) property to\n\u003e an array containing the Target Environment and one or more addon configurations.\n\n### Step 3\n\nDetermine how you are going to run `eslint`:\n\n* [npm scripts](#usage-with-npm-scripts) ([docs](https://docs.npmjs.com/misc/scripts))\n* [gulp.js](#usage-with-gulp) ([docs](https://gulpjs.com/))\n* Manually run `eslint` like it's 1999\n\n### Step 4 (optional)\n\nIt's recommended that your project have a `.eslintignore` file in the root of your project. Add all\ndirectories and file patterns you wish to ignore. At the the very least, you should ignore the\n`node_modules` directory:\n\n```\n# .eslintignore\n\nnode_modules\n```\n\n## Usage with npm Scripts\n\n### Default Configuration\n\nSelect one of target environments: `axway`, `axway/env-node`, or `axway/env-browser`. Next add a\n`lint` and `test` scripts to the `package.json`.\n\n```json\n{\n\t\"scripts\": {\n\t\t\"lint\": \"eslint --config \u003ctarget\u003e src\",\n\t\t\"test\": \"eslint --config \u003ctarget\u003e test \u0026\u0026 mocha\"\n\t}\n}\n```\n\nThen run:\n\n```bash\n$ npm run lint\n```\n\n### Custom `.eslintrc` Configurations\n\nA custom `.eslintrc` file is useful for using multiple conifgurations, defining global variables,\nincluding additional plugins, and overriding rules.\n\n#### Source Code Lint Configuration\n\nCreate a `.eslintrc` file in the root of your project and have it extend the `axway` configuration.\n\n```js\n{\n\t\"extends\": \"axway\",\n\t\"globals\": {\n\t\t// declare globals here...\n\t},\n\t\"rules\": {\n\t\t// project specific overrides...\n\t}\n}\n```\n\nFor Node.js projects that need Babel to parse bleeding edge JavaScript specs, use the `env-node`\nwith the `+babel` configuration:\n\n```js\n{\n\t\"extends\": [ \"axway/env-node\", \"axway/+babel\" ],\n\t\"globals\": {\n\t\t// declare globals here...\n\t},\n\t\"rules\": {\n\t\t// project specific overrides...\n\t}\n}\n```\n\n```\n$ npm i --save-dev babel-eslint\n```\n\n#### Unit Test Lint Configuration\n\nYou will probably also want a test-specific configuration. Create an `.eslintrc` file in your\n`test` directory.\n\n```js\n{\n\t\"extends\": [ \"axway/env-node\", \"axway/+mocha\", \"axway/+chai\" ],\n\t\"globals\": {\n\t\t// declare globals here...\n\t},\n\t\"rules\": {\n\t\t// project specific overrides...\n\t}\n}\n```\n\n```\n$ npm i --save-dev eslint-plugin-mocha\n```\n\n#### npm Scripts Configuration\n\nYour `package.json` NPM script can be simplified to:\n\n```json\n{\n\t\"scripts\": {\n\t\t\"lint\": \"eslint src\",\n\t\t\"test\": \"eslint test \u0026\u0026 mocha\"\n\t}\n}\n```\n\n## Usage with Gulp\n\n[gulp](https://gulpjs.com/) is a Node.js-based task runner. It needs to be installed globally.\n\n```\n$ [sudo] npm i -g gulp\n```\n\nStart by installing the required dev dependencies:\n\n```\n$ npm i --save-dev gulp-eslint eslint-config-axway\n```\n\n### Default Configuration with Gulp\n\nIn your `gulpfile.js`, add the following task and change as you see fit:\n\n```js\nconst eslint = require('gulp-eslint');\n\ngulp.task('lint', () =\u003e {\n\treturn gulp.src([\n\t\t\t'src/**/*.js',\n\t\t\t'test/**/test-*.js'\n\t\t])\n\t\t.pipe(eslint({\n\t\t\tconfigFile: require.resolve('eslint-config-axway')\n\t\t}))\n\t\t.pipe(eslint.format())\n\t\t.pipe(eslint.failAfterError());\n});\n```\n\n### Custom `.eslintrc` Configurations with Gulp\n\nCreate the `.eslintrc` file in the root of your project as described above and add the following to\nyour `gulpfile.js`:\n\n```js\nconst eslint = require('gulp-eslint');\n\ngulp.task('lint', () =\u003e {\n\treturn gulp.src([\n\t\t\t'src/**/*.js',\n\t\t\t'test/**/test-*.js'\n\t\t])\n\t\t.pipe(eslint())\n\t\t.pipe(eslint.format())\n\t\t.pipe(eslint.failAfterError());\n});\n```\n\n### Custom `.eslintrc` with a `eslint-config-axway`\n\nDue to the way eslint works, you cannot specify a `configFile` and an `.eslintrc` file, so you have\nto do it the hard way.\n\n```js\nconst eslint = require('gulp-eslint');\nconst fs = require('fs');\nconst path = require('path');\n\ngulp.task('lint', () =\u003e {\n\tconst baseConfig = require('eslint-config-axway');\n\n\t// check if the user has a custom .eslintrc in the root of the project\n\tlet custom = path.join(process.cwd(), '.eslintrc');\n\tif (fs.existsSync(custom)) {\n\t\t(function merge(dest, src) {\n\t\t\tfor (const key of Object.keys(src)) {\n\t\t\t\tif (src[key] \u0026\u0026 typeof src[key] === 'object' \u0026\u0026 !Array.isArray(src[key])) {\n\t\t\t\t\tif (!dest[key] || typeof dest[key] !== 'object' || Array.isArray(dest[key])) {\n\t\t\t\t\t\tdest[key] = {};\n\t\t\t\t\t}\n\t\t\t\t\tmerge(dest[key], src[key]);\n\t\t\t\t} else {\n\t\t\t\t\tdest[key] = src[key];\n\t\t\t\t}\n\t\t\t}\n\t\t}(baseConfig, JSON.parse(fs.readFileSync(custom))));\n\t}\n\n\treturn gulp.src([\n\t\t\t'src/**/*.js',\n\t\t\t'test/**/test-*.js'\n\t\t])\n\t\t.pipe(eslint({ baseConfig }))\n\t\t.pipe(eslint.format())\n\t\t.pipe(eslint.failAfterError());\n});\n```\n\n### Custom eslint Configurations for Source and Tests\n\nCreate an `.eslintrc` file in the root of your project to be used for your source code that extends\nthe `axway` configuration as described above.\n\n```js\n{\n\t\"extends\": \"axway\",\n\t\"globals\": {\n\t\t// declare globals here...\n\t},\n\t\"rules\": {\n\t\t// project specific overrides...\n\t}\n}\n```\n\nNext create a second `.eslintrc` config file in your `test` directory.\n\n```js\n{\n\t\"extends\": [ \"axway/env-node\", \"axway/+mocha\" ],\n\t\"globals\": {\n\t\t// declare globals here...\n\t},\n\t\"rules\": {\n\t\t// project specific overrides...\n\t}\n}\n```\n\nFinally split the `lint` task into `lint-src` and `lint-test` tasks:\n\n```js\nconst eslint = require('gulp-eslint');\n\ngulp.task('lint', [ 'lint-src', 'lint-test' ]);\n\ngulp.task('lint-src', () =\u003e {\n\treturn gulp.src('src/**/*.js')\n\t\t.pipe(eslint())\n\t\t.pipe(eslint.format())\n\t\t.pipe(eslint.failAfterError());\n});\n\ngulp.task('lint-test', () =\u003e {\n\treturn gulp.src('test/**/test-*.js')\n\t\t.pipe(eslint({\n\t\t\tconfigFile: './test/.eslintrc'\n\t\t}))\n\t\t.pipe(eslint.format())\n\t\t.pipe(eslint.failAfterError());\n});\n```\n\n## Usage with Titanium\n\nFor Titanium apps, you can use npm, gulp, or just manually invoke `eslint`. For this guide, we'll\ncover using npm.\n\nStart by creating a `package.json` manually or run:\n\n```\n$ npm init\n```\n\nNext install the dev dependencies:\n\n```\n$ npm install --save-dev eslint eslint-config-axway\n```\n\n### Classic Titanium Apps:\n\nCreate an .eslintrc file alongisde your `tiapp.xml` file.\n\n```js\n{\n\t\"extends\": [ \"axway/env-titanium\" ],\n\t\"globals\": {\n\t\t// declare globals here...\n\t},\n\t\"rules\": {\n\t\t// project specific overrides...\n\t}\n}\n```\n\nAdd the following `lint` script to the `package.json`:\n\n```json\n{\n\t\"scripts\": {\n\t\t\"lint\": \"eslint Resources\"\n\t}\n}\n```\n\n### Alloy Apps:\n\nInstall eslint-plugin-alloy.\n\n```\n$ npm install --save-dev eslint-plugin-alloy\n```\n\nCreate an .eslintrc file alongisde your `tiapp.xml` file\n```js\n{\n\t\"extends\": [ \"axway/env-alloy\" ],\n\t\"globals\": {\n\t\t// declare globals here...\n\t},\n\t\"rules\": {\n\t\t// project specific overrides...\n\t}\n}\n```\n\nAdd the following `lint` script to the `package.json`:\n\n```json\n{\n\t\"scripts\": {\n\t\t\"lint\": \"eslint app\"\n\t}\n}\n```\n\n### Custom `.eslintrc` for Titanium Apps\n\nDue to Alloy's code generation, you will most certainly need to create a custom `.eslintrc` to\ndeclare all the global variables. Being by creating an `.eslintrc` file in the root of your project\nand have it extend the `axway/env-titanium` configuration.\n\n```js\n{\n\t\"extends\": \"axway/env-titanium\",\n\t\"globals\": {\n\t\t// declare globals here...\n\t},\n\t\"rules\": {\n\t\t// project specific overrides...\n\t}\n}\n```\n\n### Running `eslint` for Titanium Apps\n\nYou can simply run `eslint` by running:\n\n```\n$ npm run lint\n```\n\n## License\n\nThis project is open source and provided under the Apache Public License (version 2). Please make\nsure you see the LICENSE file included in this distribution for more details on the license. Also,\nplease take notice of the privacy notice at the end of the file.\n\n(C) Copyright 2017-2018, [Axway, Inc](http://www.axway.com) All Rights Reserved.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappcelerator%2Feslint-config-axway","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fappcelerator%2Feslint-config-axway","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappcelerator%2Feslint-config-axway/lists"}