Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kopischke/eslint-config-jxa
Make ESLint play nice with JavaScript for Automation (JXA) code.
https://github.com/kopischke/eslint-config-jxa
eslint jxa
Last synced: about 2 months ago
JSON representation
Make ESLint play nice with JavaScript for Automation (JXA) code.
- Host: GitHub
- URL: https://github.com/kopischke/eslint-config-jxa
- Owner: kopischke
- License: other
- Created: 2020-10-03T16:14:38.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2020-10-31T17:50:04.000Z (over 4 years ago)
- Last Synced: 2024-10-13T18:59:14.200Z (4 months ago)
- Topics: eslint, jxa
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/eslint-config-jxa
- Size: 30.3 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# eslint-config-jxa
An [ESLint Shareable Config](https://eslint.org/docs/developer-guide/shareable-configs) to extend ESLint’s awesome linting powers to macOS JavaScript for Automation (JXA) code.
## Installation
You'll need to install [ESLint](https://eslint.org/docs/user-guide/getting-started#installation-and-usage) first, e.g.:
```sh
$ npm install eslint --save-dev
```Next, install `eslint-config-jxa`, e.g.:
```sh
$ npm install eslint-config-jxa --save-dev
```## Usage
Add the relevant configuration to your [_extends_](https://eslint.org/docs/user-guide/configuring#use-a-plugin) section.
### Basic configuration
If you use standard JavaScript file extensions (i.e. `.js`) for your JXA source code, all you have to do is to add this to your `.eslintrc.json` file`:
```json
{
"extends": [
"jxa"
]
}
```If you use the `.jxa` file extension, extend in an [_override_](https://eslint.org/docs/user-guide/configuring#configuration-based-on-glob-patterns) instead:
```json
{
"overrides": [
{
"files": ["*.jxa"],
"extends": ["jxa"]
}
]
}
```### Additional configuration
There are additional configs available for some special JXA coding scenarios:
- **objc**: for JXA source that uses the Objective C bridge.
- **library**: for JXA files intended to be loaded via `Library()`.
- **injection**: for JXA files intended as [JXA Infusion][jxa-infusion] injections.Note these will only work in conjunction with the basic configuration. Because the additional configurations restrict the scope of, or, in the case of the _objc_ rules, entirely disable some ESLint checks, you should only include them in very specific overrides, e.g. (example taken from the [JXA Infusion][jxa-infusion] project):
```json
"overrides": [
{
"files": ["*.jxa"],
"extends": ["jxa"]
},
{
"files": ["Injections/**/*.jxa"],
"extends": [
"jxa/objc",
"jxa/injection"
]
},
{
"files": ["Libraries/**/*.jxa"],
"extends": [
"jxa/objc",
"jxa/library"
]
}
]
```### License
This config is shared under the [MIT License](https://github.com/kopischke/eslint-config-jxa/blob/main/LICENSE.md).
[jxa-infusion]: https://github.com/kopischke/JXA-Infusion